Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
a86dfcfe97 | |||
5227ceaf5c |
|
@ -52,14 +52,18 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
firstColMenu = new QMenu(this);
|
firstColMenu = new QMenu(this);
|
||||||
QAction* addRowAboveAction = firstColMenu->addAction(tr("↑ 向上添加一行"));
|
QAction* addRowAboveAction = firstColMenu->addAction(tr("↑ 向上添加一行"));
|
||||||
QAction* addRowBelowAction = firstColMenu->addAction(tr("向下添加一行 ↓"));
|
QAction* addRowBelowAction = firstColMenu->addAction(tr("向下添加一行 ↓"));
|
||||||
|
QAction* delRowAction = firstColMenu->addAction(tr("删除"));
|
||||||
connect(addRowAboveAction, &QAction::triggered, this, &MainWindow::onAddRowAboveActionTriggered);
|
connect(addRowAboveAction, &QAction::triggered, this, &MainWindow::onAddRowAboveActionTriggered);
|
||||||
connect(addRowBelowAction, &QAction::triggered, this, &MainWindow::onAddRowBelowActionTriggered);
|
connect(addRowBelowAction, &QAction::triggered, this, &MainWindow::onAddRowBelowActionTriggered);
|
||||||
|
connect(delRowAction, &QAction::triggered, this, &MainWindow::onDelRowActionTriggered);
|
||||||
|
|
||||||
firstRowMenu = new QMenu(this);
|
firstRowMenu = new QMenu(this);
|
||||||
QAction* addColAboveAction = firstRowMenu->addAction(tr("← 向左添加一列"));
|
QAction* addColAboveAction = firstRowMenu->addAction(tr("← 向左添加一列"));
|
||||||
QAction* addColBelowAction = firstRowMenu->addAction(tr("向右添加一列 →"));
|
QAction* addColBelowAction = firstRowMenu->addAction(tr("向右添加一列 →"));
|
||||||
|
QAction* delColAction = firstRowMenu->addAction(tr("删除"));
|
||||||
connect(addColAboveAction, &QAction::triggered, this, &MainWindow::onAddColAboveActionTriggered);
|
connect(addColAboveAction, &QAction::triggered, this, &MainWindow::onAddColAboveActionTriggered);
|
||||||
connect(addColBelowAction, &QAction::triggered, this, &MainWindow::onAddColBelowActionTriggered);
|
connect(addColBelowAction, &QAction::triggered, this, &MainWindow::onAddColBelowActionTriggered);
|
||||||
|
connect(delColAction, &QAction::triggered, this, &MainWindow::onDelColActionTriggered);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,6 +160,20 @@ void MainWindow::onAddColBelowActionTriggered()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::onDelRowActionTriggered()
|
||||||
|
{
|
||||||
|
QTableWidget* tableWidget = ui->tableWidget;
|
||||||
|
int currentRow = tableWidget->currentRow();
|
||||||
|
tableWidget->removeRow(currentRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onDelColActionTriggered()
|
||||||
|
{
|
||||||
|
QTableWidget* tableWidget = ui->tableWidget;
|
||||||
|
int currentColumn = tableWidget->currentColumn();
|
||||||
|
tableWidget->removeColumn(currentColumn);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::showProgressDialog(const QString& labelText, int minimum, int maximum)
|
void MainWindow::showProgressDialog(const QString& labelText, int minimum, int maximum)
|
||||||
{
|
{
|
||||||
progressDialog = new QProgressDialog(labelText, "Cancel", minimum, maximum, this);
|
progressDialog = new QProgressDialog(labelText, "Cancel", minimum, maximum, this);
|
||||||
|
@ -298,7 +316,7 @@ void MainWindow::onSaveButtonClicked()
|
||||||
out << "\t"; // 制表符分隔
|
out << "\t"; // 制表符分隔
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
out << "\t"; // 最后一列再加一个制表符,以防万一
|
||||||
out << "\r\n"; // 换行,注意使用\r\n表示换行符
|
out << "\r\n"; // 换行,注意使用\r\n表示换行符
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +362,7 @@ void MainWindow::onSaveAsButtonClicked()
|
||||||
out << "\t"; // 制表符分隔
|
out << "\t"; // 制表符分隔
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
out << "\t"; // 最后一列再加一个制表符,以防万一
|
||||||
out << "\r\n"; // 换行,注意使用\r\n表示换行符
|
out << "\r\n"; // 换行,注意使用\r\n表示换行符
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,6 +615,7 @@ void MainWindow::convertSqliteToText()
|
||||||
if (i < record.count() - 1)
|
if (i < record.count() - 1)
|
||||||
textStream << "\t";
|
textStream << "\t";
|
||||||
}
|
}
|
||||||
|
textStream << "\t";
|
||||||
textStream << "\r\n";
|
textStream << "\r\n";
|
||||||
|
|
||||||
++progress;
|
++progress;
|
||||||
|
|
|
@ -35,6 +35,8 @@ private slots:
|
||||||
void onAddRowBelowActionTriggered();
|
void onAddRowBelowActionTriggered();
|
||||||
void onAddColAboveActionTriggered();
|
void onAddColAboveActionTriggered();
|
||||||
void onAddColBelowActionTriggered();
|
void onAddColBelowActionTriggered();
|
||||||
|
void onDelRowActionTriggered();
|
||||||
|
void onDelColActionTriggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTableWidget" name="tableWidget"/>
|
<widget class="QTableWidget" name="tableWidget"/>
|
||||||
</item>
|
</item>
|
||||||
|
@ -46,7 +49,6 @@
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuOpen"/>
|
<addaction name="menuOpen"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
|
||||||
<action name="actionOpen">
|
<action name="actionOpen">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>打开</string>
|
<string>打开</string>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user