//! Удаление строк //! void TTextStruct::delTop() { int CheckForContent = 0; if( CheckForContent = findInText("Содержание") != -1); { do{text->Delete(0); ++CheckForContent;}while ( CheckForContent !=35); } }
void NotesTextEdit::keyPressEvent( QKeyEvent* event ) { if (event->modifiers() == Qt::ControlModifier && Qt::Key_F == event->key()) { emit findInText(); return; } if (Qt::Key_F3 == event->key()) { emit findInTextNext(); return; } QTextEdit::keyPressEvent(event); }
void MaMainWindow::createLeftPane() { mTreeDockWidget = new QDockWidget(tr("List"), this); mTreeDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); mLeftPaneTabWidget = new QTabWidget(mTreeDockWidget); mTreeDockWidget->setWidget(mLeftPaneTabWidget); addDockWidget(Qt::LeftDockWidgetArea, mTreeDockWidget); // Full item list: mItemTreeWidget = new MaTreeWidget(mTreeDockWidget); mItemTreeWidget->setColumnCount(1); mItemTreeWidget->setHeaderLabel("All Items"); mItemTreeWidget->setSortingEnabled(true); mLeftPaneTabWidget->addTab(mItemTreeWidget, "List"); // Filtered Tree: QFrame* findItemsFrame = new QFrame(); QVBoxLayout* vlayout = new QVBoxLayout(); vlayout->setContentsMargins (0, 0, 0, 0); findItemsFrame->setLayout(vlayout); mLeftPaneTabWidget->addTab(findItemsFrame, "Find Items"); // Search form: QFrame* findFormFrame = new QFrame(); QHBoxLayout* hlayout = new QHBoxLayout(); hlayout->setContentsMargins (2, 2, 2, 2); findFormFrame->setLayout(hlayout); hlayout->addWidget(new QLabel("Search For:")); mFindItemsLineEdit = new QLineEdit(); hlayout->addWidget(mFindItemsLineEdit); mFindItemsButton = new QPushButton("&Find"); mFindItemsButton->setDefault(true); hlayout->addWidget(mFindItemsButton); mExitFindItemsButton = new QPushButton("&Back"); hlayout->addWidget(mExitFindItemsButton); vlayout->addWidget(findFormFrame); // Filtered Tree: mFilteredTreeWidget = new MaTreeWidget(); mFilteredTreeWidget->setColumnCount(1); mFilteredTreeWidget->setHeaderLabel("Find Result"); mFilteredTreeWidget->setSortingEnabled(true); vlayout->addWidget(mFilteredTreeWidget); /* // Close search button: QFrame* exitFindButtonFrame = new QFrame(); hlayout = new QHBoxLayout(); vlayout->setContentsMargins (0, 0, 0, 0); exitFindButtonFrame->setLayout(hlayout); hlayout->addStretch(1); // hlayout->setDirection(QBoxLayout::RightToLeft); mExitFindItemsButton = new QPushButton("&Back"); hlayout->addWidget(mExitFindItemsButton); vlayout->addWidget(exitFindButtonFrame); */ viewMenu->addAction(mTreeDockWidget->toggleViewAction()); connect(mItemTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(itemTreeCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*))); connect(mFilteredTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(itemTreeCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*))); connect(mLeftPaneTabWidget, SIGNAL(currentChanged(int)), this, SLOT(onLeftPaneTabIndexChanged(int))); connect(mCaptionTextEditWidget, SIGNAL(textEdited(const QString&)), this, SLOT(captionEdited(const QString&))); connect(mFindItemsButton, SIGNAL(pressed()), this, SLOT(onFindItemsButtonPressed())); connect(mFindItemsLineEdit, SIGNAL(returnPressed()), this, SLOT(onFindItemsButtonPressed())); connect(mExitFindItemsButton, SIGNAL(pressed()), this, SLOT(onExitFindItemsButton())); connect(mEditProtectionButton, SIGNAL(pressed()), this, SLOT(onOpenItemProtectionDialog())); connect(mFindInTextButton, SIGNAL(pressed()), this, SLOT(onFindInText())); connect(mFindNextInTextButton, SIGNAL(pressed()), this, SLOT(onFindInTextNext())); connect(mClearFindInTextButton, SIGNAL(pressed()), this, SLOT(onClearFindInText())); connect(mFindInTextLineEdit, SIGNAL(returnPressed()), this, SLOT(onFindInText())); connect(mFindInTextLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(onFindInTextLineEditTextEdited(const QString&))); connect(mNotesTextEditWidget, SIGNAL(findInText()), this, SLOT(onFindInText())); connect(mNotesTextEditWidget, SIGNAL(findInTextNext()), this, SLOT(onFindInTextNext())); }