Skip to content

Commit

Permalink
例子添加搜索框
Browse files Browse the repository at this point in the history
  • Loading branch information
czyt1988 committed Dec 25, 2023
1 parent a4a8f58 commit 2937ea0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/example/MainWindowExample/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <QXmlStreamWriter>
#include <QMessageBox>
#include <QShortcut>
#include <QLineEdit>
#define PRINT_COST_START() \
QElapsedTimer __TMP_COST; \
__TMP_COST.start(); \
Expand Down Expand Up @@ -1245,6 +1246,15 @@ void MainWindow::createQuickAccessBar(SARibbonQuickAccessBar* quickAccessBar)
QAction* actionCustomizeAndSave = createAction("customize and save", ":/icon/icon/customize.svg");
quickAccessBar->addAction(actionCustomizeAndSave);
connect(actionCustomizeAndSave, &QAction::triggered, this, &MainWindow::onActionCustomizeAndSaveTriggered);

//
mSearchEditor = new QLineEdit(this);
mSearchEditor->setFixedWidth(100);
mSearchEditor->setPlaceholderText("Search");
quickAccessBar->addWidget(mSearchEditor);
connect(mSearchEditor, &QLineEdit::editingFinished, this, [ this ]() {
this->mTextedit->append(this->mSearchEditor->text());
});
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/example/MainWindowExample/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class SARibbonPannel;
class QTextEdit;
class QComboBox;
class QCloseEvent;
class QLineEdit;

class MainWindow : public SARibbonMainWindow
{
Expand Down Expand Up @@ -84,6 +85,7 @@ private slots:
int mTagForActionIcon;
QMenu* mMenuApplicationBtn;
QComboBox* mComboboxRibbonTheme;
QLineEdit* mSearchEditor { nullptr };
//
QAction* mActionWordWrap { nullptr };
QAction* mActionDisable { nullptr };
Expand Down

0 comments on commit 2937ea0

Please sign in to comment.