src/main.cpp

changeset 327
2aa15daa0216
parent 325
64ddcd77639f
child 328
3ea38fd469ca
equal deleted inserted replaced
326:65dbfcb859a7 327:2aa15daa0216
1 #include <QApplication> 1 #include <QApplication>
2 #include <QClipboard>
2 #include <QCloseEvent> 3 #include <QCloseEvent>
3 #include <QFileDialog> 4 #include <QFileDialog>
4 #include <QMdiSubWindow> 5 #include <QMdiSubWindow>
5 #include <QMessageBox> 6 #include <QMessageBox>
6 #include <QScrollBar> 7 #include <QScrollBar>
777 ui.actionNew->trigger(); 778 ui.actionNew->trigger();
778 } 779 }
779 about(&mainWindow); 780 about(&mainWindow);
780 } 781 }
781 ); 782 );
783 QObject::connect(
784 ui.actionCopy,
785 &QAction::triggered,
786 [&]{
787 if (Model* model = currentModelBody(&ui, &documents)) {
788 std::vector<int> selectedRows = rows(ui.modelListView->selectionModel()->selectedRows());
789 QString text;
790 for (int row : selectedRows) {
791 const std::size_t i = static_cast<std::size_t>(row);
792 text += modelElementToString((*model)[i]);
793 text += QStringLiteral("\r\n");
794 }
795 app.clipboard()->setText(text);
796 }
797 });
782 mainWindow.tabifyDockWidget(ui.messageLogDock, ui.toolOptionsDock); 798 mainWindow.tabifyDockWidget(ui.messageLogDock, ui.toolOptionsDock);
783 mainWindow.restoreGeometry(setting<Setting::MainWindowGeometry>()); 799 mainWindow.restoreGeometry(setting<Setting::MainWindowGeometry>());
784 mainWindow.restoreState(setting<Setting::MainWindowState>()); 800 mainWindow.restoreState(setting<Setting::MainWindowState>());
785 // If a dock is made floating and the app is closed, the dock becomes invisible 801 // If a dock is made floating and the app is closed, the dock becomes invisible
786 // after the restoreState call. So we make them visible again here. 802 // after the restoreState call. So we make them visible again here.

mercurial