QTabWidget *OptionDialog::createTabs() { tabs = new QTabWidget(this); for (int i = 0; i < myFractal->_funcCount; ++i) tabs->addTab(new FunctionTab(myFractal->_functions[i]), QString::number(i + 1)); QToolButton *newTabButton = new QToolButton(tabs); newTabButton->setCursor(Qt::ArrowCursor); newTabButton->setAutoRaise(true); newTabButton->setIcon(QIcon(":/images/plus_16.png")); newTabButton->setToolTip(tr("Add function")); tabs->setCornerWidget(newTabButton, Qt::TopLeftCorner); QToolButton *closeTabButton = new QToolButton(tabs); closeTabButton->setCursor(Qt::ArrowCursor); closeTabButton->setAutoRaise(true); closeTabButton->setIcon(QIcon(":/images/delete_16.png")); closeTabButton->setToolTip(tr("Remove function")); tabs->setCornerWidget(closeTabButton, Qt::TopRightCorner); tabs->repaint(); connect(closeTabButton, SIGNAL(clicked()), this, SLOT(remFunc())); connect(newTabButton, SIGNAL(clicked()), this, SLOT(addFunc())); // connect(tabs,SIGNAL(currentChanged(int)),this,SLOT(tabChange(false))); return tabs; }
void MusicSystemTrayMenu::createPlayWidgetActions() { m_widgetAction = new QWidgetAction(this); QWidget *widgetActionContainer = new QWidget(this); QVBoxLayout *vbox = new QVBoxLayout(widgetActionContainer); vbox->setMargin(0); QWidget *widgetContainer = new QWidget(widgetActionContainer); QHBoxLayout *box = new QHBoxLayout(widgetContainer); box->setMargin(0); QToolButton *previousPlay = new QToolButton(widgetContainer); QToolButton *nextPlay = new QToolButton(widgetContainer); m_PlayOrStop = new QToolButton(widgetContainer); previousPlay->setIcon(QIcon(QString::fromUtf8(":/contextMenu/sysprevious"))); nextPlay->setIcon(QIcon(QString::fromUtf8(":/contextMenu/sysnext"))); m_PlayOrStop->setIcon(QIcon(QString::fromUtf8(":/contextMenu/sysplay"))); previousPlay->setIconSize(QSize(40, 40)); nextPlay->setIconSize(QSize(40, 40)); m_PlayOrStop->setIconSize(QSize(45, 45)); previousPlay->setStyleSheet(MusicUIObject::MToolButtonStyle01); nextPlay->setStyleSheet(MusicUIObject::MToolButtonStyle01); m_PlayOrStop->setStyleSheet(MusicUIObject::MToolButtonStyle01); previousPlay->setCursor(QCursor(Qt::PointingHandCursor)); nextPlay->setCursor(QCursor(Qt::PointingHandCursor)); m_PlayOrStop->setCursor(QCursor(Qt::PointingHandCursor)); previousPlay->setToolTip(tr("Previous")); nextPlay->setToolTip(tr("Next")); m_PlayOrStop->setToolTip(tr("Play")); box->addWidget(previousPlay); box->addWidget(m_PlayOrStop); box->addWidget(nextPlay); m_showText = new QLabel(widgetActionContainer); m_showText->setAlignment(Qt::AlignCenter); m_showText->setStyleSheet(MusicUIObject::MCustomStyle12); vbox->addWidget(widgetContainer); vbox->addWidget(m_showText); widgetActionContainer->setLayout(vbox); m_widgetAction->setDefaultWidget(widgetActionContainer); connect(previousPlay, SIGNAL(clicked()), parent(), SLOT(musicPlayPrevious())); connect(nextPlay, SIGNAL(clicked()), parent(), SLOT(musicPlayNext())); connect(m_PlayOrStop, SIGNAL(clicked()), parent(), SLOT(musicStatePlay())); }
void WelcomeWidget::UpdateRecentProjects( const QVector<RecentProject> &recent_projects) { ui->tableWidgetRecent->clearContents(); ui->tableWidgetRecent->setRowCount(recent_projects.count()); int row = 0; QSignalMapper *mapper = new QSignalMapper; for (const RecentProject &recent_project : recent_projects) { QTableWidgetItem *item_name = new QTableWidgetItem(recent_project.name()); QTableWidgetItem *item_path = new QTableWidgetItem(recent_project.path()); QToolButton *erase = new QToolButton; erase->setStyleSheet("border: 0;"); erase->setCursor(QCursor(Qt::PointingHandCursor)); erase->setIcon(QIcon(":/icons/images/remove.png")); erase->setIconSize(QSize(12, 12)); connect(erase, SIGNAL(clicked()), mapper, SLOT(map())); mapper->setMapping(erase, row); QFont font = item_name->font(); font.setBold(true); item_name->setFont(font); item_name->setToolTip(recent_project.name()); item_path->setToolTip(recent_project.path()); ui->tableWidgetRecent->setIndexWidget( ui->tableWidgetRecent->model()->index(row, 0), erase); ui->tableWidgetRecent->setItem(row, 1, item_name); ui->tableWidgetRecent->setItem(row, 2, item_path); ++row; } connect(mapper, SIGNAL(mapped(int)), parent_, SLOT(RemoveRecentProject(int))); }
WNavigationTreeCaption::WNavigationTreeCaption() { QToolButton * pwButtonUndock = new QToolButton(this); pwButtonUndock->setToolTip("Float / Unfloat"); #if 1 pwButtonUndock->setStyleSheet("QToolButton { border: none; padding: 3px; }"); #else pwButtonUndock->setStyleSheet("QToolButton { border: none; padding: 0px; }"); #endif QPixmap oPixmap = style()->standardPixmap(QStyle::SP_TitleBarNormalButton); pwButtonUndock->setIcon(oPixmap); // pwButtonUndock->setMaximumSize(oPixmap.size()); pwButtonUndock->setCursor(Qt::ArrowCursor); pwButtonUndock->setFocusPolicy(Qt::ClickFocus); QHBoxLayout * layout = new QHBoxLayout(this); layout->setMargin(0); // layout->setSpacing(10); // layout->addStretch(); #if 0 layout->addWidget(g_pwButtonStatusOfNavigationTree, Qt::AlignLeft | Qt::AlignHCenter); #endif layout->addWidget(g_pwButtonSwitchProfile); // , Qt::AlignLeft | Qt::AlignHCenter); //layout->addWidget(new QWidget); layout->addStretch(); //layout->addWidget(pwButtonUndock, Qt::AlignRight | Qt::AlignHCenter); layout->addWidget(pwButtonUndock); setLayout(layout); connect(pwButtonUndock, SIGNAL(clicked()), g_pwNavigationTree, SLOT(SL_ToggleDocking())); setCursor(Qt::OpenHandCursor); // This cursor shows to the user he/she may drag the widget to undock the Navigation Tree }
void QgsGuiVectorLayerTools::commitError( QgsVectorLayer* vlayer ) const { QgsMessageViewer *mv = new QgsMessageViewer(); mv->setWindowTitle( tr( "Commit errors" ) ); mv->setMessageAsPlainText( tr( "Could not commit changes to layer %1" ).arg( vlayer->name() ) + "\n\n" + tr( "Errors: %1\n" ).arg( vlayer->commitErrors().join( "\n " ) ) ); QToolButton *showMore = new QToolButton(); // store pointer to vlayer in data of QAction QAction *act = new QAction( showMore ); act->setData( QVariant( QMetaType::QObjectStar, &vlayer ) ); act->setText( tr( "Show more" ) ); showMore->setStyleSheet( "background-color: rgba(255, 255, 255, 0); color: black; text-decoration: underline;" ); showMore->setCursor( Qt::PointingHandCursor ); showMore->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Preferred ); showMore->addAction( act ); showMore->setDefaultAction( act ); connect( showMore, SIGNAL( triggered( QAction* ) ), mv, SLOT( exec() ) ); connect( showMore, SIGNAL( triggered( QAction* ) ), showMore, SLOT( deleteLater() ) ); // no timeout set, since notice needs attention and is only shown first time layer is labeled QgsMessageBarItem *errorMsg = new QgsMessageBarItem( tr( "Commit errors" ), tr( "Could not commit changes to layer %1" ).arg( vlayer->name() ), showMore, QgsMessageBar::WARNING, 0, QgisApp::instance()->messageBar() ); QgisApp::instance()->messageBar()->pushItem( errorMsg ); }
QtChatWindow::AlertID QtChatWindow::addAlert(const std::string& alertText) { QWidget* alertWidget = new QWidget(this); QHBoxLayout* alertLayout = new QHBoxLayout(alertWidget); alertLayout_->addWidget(alertWidget); QLabel* alertLabel = new QLabel(this); alertLabel->setText(alertText.c_str()); alertLayout->addWidget(alertLabel); QToolButton* closeButton = new QToolButton(alertWidget); closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton)); closeButton->setIconSize(QSize(16,16)); closeButton->setCursor(Qt::ArrowCursor); closeButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); connect (closeButton, SIGNAL(clicked()), this, SLOT(handleAlertButtonClicked())); alertLayout->addWidget(closeButton); QPalette palette = alertWidget->palette(); palette.setColor(QPalette::Window, QColor(Qt::yellow)); palette.setColor(QPalette::WindowText, QColor(Qt::black)); alertWidget->setStyleSheet(alertStyleSheet_); alertLabel->setStyleSheet(alertStyleSheet_); AlertID id = nextAlertId_++; alertWidgets_[id] = alertWidget; return id; }
MusicSongsSummariziedFloatWidget::MusicSongsSummariziedFloatWidget(QWidget *parent) : QLabel(parent) { setWindowFlags( Qt::Window | Qt::FramelessWindowHint ); setObjectName("MainWidget"); setStyleSheet("#MainWidget{background:rgba(0, 0, 0, 60);}"); resize(60, 25); MusicUtils::widgetToRound(this, 10, 10); QHBoxLayout *layout = new QHBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); QToolButton *locationButton = new QToolButton(this); QToolButton *searchButton = new QToolButton(this); layout->addWidget(locationButton); layout->addWidget(searchButton); locationButton->setIcon(QIcon(QString::fromUtf8(":/appTools/location"))); locationButton->setIconSize(QSize(20, 20)); locationButton->setStyleSheet(MusicUIObject::MToolButtonStyle03); locationButton->setCursor(QCursor(Qt::PointingHandCursor)); searchButton->setIcon(QIcon(QString::fromUtf8(":/appTools/search"))); searchButton->setIconSize(QSize(20, 20)); searchButton->setStyleSheet(MusicUIObject::MToolButtonStyle03); searchButton->setCursor(QCursor(Qt::PointingHandCursor)); connect(locationButton, SIGNAL(clicked()), SIGNAL(musicCurrentPlayLocation())); connect(searchButton, SIGNAL(clicked()), SIGNAL(musicSearch())); m_currentAnimationValue = 1; m_timer.setInterval(3*1000); connect(&m_timer, SIGNAL(timeout()), SLOT(leaveTimeout())); m_animation = new QPropertyAnimation(this, "windowOpacity"); m_animation->setDuration(1000); connect(m_animation, SIGNAL(finished()), SLOT(animationFinished())); M_CONNECTION->setValue("MusicSongsSummariziedFloatWidget", this); M_CONNECTION->poolConnect("MusicSongsSummariziedFloatWidget", "MusicBottomAreaWidget"); M_CONNECTION->poolConnect("MusicSongsSummariziedFloatWidget", "MusicApplication"); m_timer.start(); }
QToolButton* SelectPathWidgetBase::CreateToolButton(const DAVA::String& iconPath) { QToolButton* retButton; retButton = new QToolButton(this); QIcon icon(iconPath.c_str()); retButton->setIcon(icon); retButton->setCursor(Qt::ArrowCursor); retButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth); QSize msz = minimumSizeHint(); setStyleSheet(QString("QLineEdit { padding-right: %1px; } ").arg(retButton->sizeHint().width() * 2 + frameWidth)); setMinimumSize(qMax(msz.width(), retButton->sizeHint().height() + frameWidth * 2 + 2), qMax(msz.height(), retButton->sizeHint().height() + frameWidth * 2 + 2)); return retButton; }
FilterWidget::FilterWidget(QWidget *parent) : QLineEdit(parent) , m_patternGroup(new QActionGroup(this)) { setClearButtonEnabled(true); connect(this, SIGNAL(textChanged(QString)), this, SIGNAL(filterChanged())); QMenu *menu = new QMenu(this); m_caseSensitivityAction = menu->addAction(tr("Case Sensitive")); m_caseSensitivityAction->setCheckable(true); connect(m_caseSensitivityAction, SIGNAL(toggled(bool)), this, SIGNAL(filterChanged())); menu->addSeparator(); m_patternGroup->setExclusive(true); QAction *patternAction = menu->addAction("Fixed String"); patternAction->setData(QVariant(int(QRegExp::FixedString))); patternAction->setCheckable(true); patternAction->setChecked(true); m_patternGroup->addAction(patternAction); patternAction = menu->addAction("Regular Expression"); patternAction->setCheckable(true); patternAction->setData(QVariant(int(QRegExp::RegExp2))); m_patternGroup->addAction(patternAction); patternAction = menu->addAction("Wildcard"); patternAction->setCheckable(true); patternAction->setData(QVariant(int(QRegExp::Wildcard))); m_patternGroup->addAction(patternAction); connect(m_patternGroup, SIGNAL(triggered(QAction*)), this, SIGNAL(filterChanged())); const QIcon icon = QIcon(QPixmap(":/images/find.png")); QToolButton *optionsButton = new QToolButton; #ifndef QT_NO_CURSOR optionsButton->setCursor(Qt::ArrowCursor); #endif optionsButton->setFocusPolicy(Qt::NoFocus); optionsButton->setStyleSheet("* { border: none; }"); optionsButton->setIcon(icon); optionsButton->setMenu(menu); optionsButton->setPopupMode(QToolButton::InstantPopup); QWidgetAction *optionsAction = new QWidgetAction(this); optionsAction->setDefaultWidget(optionsButton); addAction(optionsAction, QLineEdit::LeadingPosition); }
QToolButton* QuickButtonDisplay::actionButton(const char* objName, const char* icon, QString value) { QToolButton* toolButton = new QToolButton(); toolButton->setIconSize(QSize(32, 32)); toolButton->setObjectName(objName); toolButton->setIcon(QIcon(icon)); toolButton->setText(value); toolButton->setToolTip(value); toolButton->setCursor(Qt::PointingHandCursor); toolButton->setContextMenuPolicy(Qt::CustomContextMenu); toolButton->setStyleSheet("QToolButton {" "background: #242024;" "}"); connect(toolButton, SIGNAL(clicked()), toolBar, SLOT(quickButtonAction())); return toolButton; }
MediaSearchWidget::MediaSearchWidget(QWidget *parent) : QWidget(parent) { // m_animate = new StateMachineServer; this->setMinimumSize(160, 20); this->setFixedSize(160, 20); m_searchKeyEdit = new QLineEdit; m_searchKeyEdit->setText( tr("Searching...") ); QToolButton* searchBtn = new QToolButton; QSize size = QSize( 20, this->size().height() ); searchBtn->setMinimumSize(size); searchBtn->setMaximumSize(size); searchBtn->setIconSize(size); searchBtn->setIcon( QIcon(":/images/Button-search.png")); searchBtn->setFocusPolicy(Qt::NoFocus);// 得到焦点时,不显示虚线框 searchBtn->setCursor(QCursor(Qt::PointingHandCursor)); QHBoxLayout *editLayout = new QHBoxLayout(); editLayout->setContentsMargins(0, 0, 0, 0); editLayout->addStretch(); editLayout->addWidget(searchBtn); m_searchKeyEdit->setLayout(editLayout); // 设置输入框中文件输入区,不让输入的文字在被隐藏在按钮下 m_searchKeyEdit->setTextMargins(0, 1, size.width(), 1); QHBoxLayout* hLayout = new QHBoxLayout; hLayout->setContentsMargins(0,0,0,0); hLayout->setSpacing(4); hLayout->addWidget(m_searchKeyEdit); hLayout->setAlignment(Qt::AlignLeft); this->setLayout(hLayout); connect(searchBtn, SIGNAL(clicked()), this, SLOT(searchMusic()) ); // connect(this, SIGNAL(animateHide()), m_animate, SIGNAL(transHide()) ); // /connect(this, SIGNAL(animateShow()), m_animate, SIGNAL(transShow()) ); }
DatasetsListWidget::DatasetsListWidget(DatasetsController *_ctrl) : QWidget(), ctrl(_ctrl) { QVBoxLayout *l = new QVBoxLayout(this); l->setMargin(0); tabs = new DatasetsTabWidget(this); l->addWidget(tabs); QToolButton *newTabButton = new QToolButton(this); tabs->setCornerWidget(newTabButton, Qt::TopRightCorner); newTabButton->setCursor(Qt::ArrowCursor); newTabButton->setAutoRaise(true); newTabButton->setText("+"); newTabButton->setObjectName("+"); newTabButton->setToolTip(tr("Add dataset")); QIcon addIcon = QIcon(QString(":U2Designer/images/add.png")); newTabButton->setIcon(addIcon); connect(newTabButton, SIGNAL(clicked()), SLOT(sl_newDataset())); connect(tabs, SIGNAL(tabCloseRequested(int)), SLOT(sl_deleteDataset(int))); connect(tabs, SIGNAL(si_contextMenu(const QPoint &, int)), SLOT(sl_contextMenu(const QPoint &, int))); }
TabWidget::TabWidget(QWidget *parent) : QTabWidget(parent){ EditableTabBar* t = new EditableTabBar(); connect(t, SIGNAL(tabTextChanged(int, const QString &)), this,SLOT(tabTextChanged(int, const QString &))); setTabBar(t); this->setTabsClosable(true); this->setMovable(true); this->setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(contextMenu(const QPoint&))); connect(this,SIGNAL(tabCloseRequested(int)),this,SLOT(closeTab(int))); QToolButton *toolb = new QToolButton(this); toolb->setCursor(Qt::ArrowCursor); toolb->setToolTip("Add tab"); toolb->setAutoRaise(true); toolb->setIcon(QIcon(":/plus.png")); this->setCornerWidget(toolb, Qt::TopLeftCorner); connect(toolb,SIGNAL(clicked()),this,SLOT(addTab())); }
SelectionView::SelectionView(Gui::Document* pcDocument, QWidget *parent) : DockWindow(pcDocument,parent) { setWindowTitle( tr( "Property View" ) ); QVBoxLayout* pLayout = new QVBoxLayout( this ); pLayout->setSpacing( 0 ); pLayout->setMargin ( 0 ); QLineEdit* searchBox = new QLineEdit(this); #if QT_VERSION >= 0x040700 searchBox->setPlaceholderText( tr( "Search" ) ); #endif searchBox->setToolTip( tr( "Searches object labels" ) ); pLayout->addWidget( searchBox ); QHBoxLayout* llayout = new QHBoxLayout(searchBox); QToolButton* clearButton = new QToolButton(searchBox); clearButton->setFixedSize(18, 21); clearButton->setCursor(Qt::ArrowCursor); clearButton->setStyleSheet(QString::fromAscii("QToolButton {margin-bottom:6px}")); clearButton->setIcon(BitmapFactory().pixmap(":/icons/edit-cleartext.svg")); clearButton->setToolTip( tr( "Clears the search field" ) ); llayout->addWidget(clearButton,0,Qt::AlignRight); selectionView = new QListWidget(this); selectionView->setContextMenuPolicy(Qt::CustomContextMenu); pLayout->addWidget( selectionView ); resize( 200, 200 ); QObject::connect(clearButton, SIGNAL(clicked()), searchBox, SLOT(clear())); QObject::connect(searchBox, SIGNAL(textChanged(QString)), this, SLOT(search(QString))); QObject::connect(selectionView, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(select(QListWidgetItem*))); QObject::connect(selectionView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onItemContextMenu(QPoint))); Gui::Selection().Attach(this); }
void SideBarCalendar::setUpViewMiniCalendar(){ miniCal = new CustomCalendarWidget; QToolButton* next = new QToolButton; QToolButton* prev = new QToolButton; QPushButton* today = new QPushButton("Aujourd'hui"); year = new QLabel(QString::number(miniCal->selectedDate().year())); month = new QLabel(QDate::longMonthName(miniCal->selectedDate().month())); QString styleToolButton = "QToolButton {background-color: rgba(0,0,0,0)}"; QSize sizeToolButton(24,24); next->setIcon(QIcon(":/icons/img/icons/ic_chevron_right_48px.svg")); next->setStyleSheet(styleToolButton); next->setIconSize(sizeToolButton); next->setCursor(Qt::PointingHandCursor); prev->setIcon(QIcon(":/icons/img/icons/ic_chevron_left_48px.svg")); prev->setStyleSheet(styleToolButton); prev->setIconSize(sizeToolButton); prev->setCursor(Qt::PointingHandCursor); /* Infos jour sélectionné * Contient : No du jour et nom du jour de la semaine */ currentDayCal = new DayWidget; currentDayCal->setDayName(QDate::longDayName(miniCal->selectedDate().dayOfWeek())); currentDayCal->setDayNumber(miniCal->selectedDate().day()); /* Header * Contient: Bouton next, prev, mois et année */ QWidget* header = new QWidget; header->setStyleSheet("QLabel{font-size: 16px;}"); QHBoxLayout* headerLayout = new QHBoxLayout; headerLayout->addWidget(prev); headerLayout->addStretch(1); headerLayout->addWidget(month); headerLayout->addWidget(year); headerLayout->addStretch(1); headerLayout->addWidget(next); header->setLayout(headerLayout); /* * Layout principale * Contient: Header et Calendar */ layoutMiniCalendar = new QVBoxLayout; layoutMiniCalendar->addWidget(currentDayCal); layoutMiniCalendar->addWidget(header); layoutMiniCalendar->addWidget(today, 0, Qt::AlignCenter); layoutMiniCalendar->addWidget(miniCal, 0, Qt::AlignHCenter); layoutMiniCalendar->addStretch(1); miniCal->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); miniCal->setFixedHeight(280); miniCal->setFixedWidth(280); connect(prev, SIGNAL(clicked()), miniCal, SLOT(showPreviousMonth())); connect(next, SIGNAL(clicked()), miniCal, SLOT(showNextMonth())); connect(miniCal, SIGNAL(currentPageChanged(int,int)), this, SLOT(pageChanged(int,int))); connect(miniCal, SIGNAL(selectionChanged()), this, SLOT(onDayClicked())); connect(today, SIGNAL(clicked()), this, SLOT(onTodayClicked())); viewMiniCalendar->setLayout(layoutMiniCalendar); }
DirBrowser::DirBrowser(QWidget *parent, Playlist *pl) : QWidget(parent), ui(new Ui::DirBrowser), m_pl(pl), m_insertactive(false) { QKeySequence seq; QShortcut *sc; ui->setupUi(this); ui->searchFrame->hide(); ui->tabs->setTabsClosable(true); QToolButton *plusbut = new QToolButton(this); QString icon_path = Helper::getIconPath(); QIcon icon = QIcon(icon_path + "/addtab.png"); plusbut->setIcon(icon); ui->tabs->setCornerWidget(plusbut, Qt::TopRightCorner); plusbut->setCursor(Qt::ArrowCursor); plusbut->setAutoRaise(true); plusbut->setToolTip(tr("Add tab")); connect(plusbut, SIGNAL(clicked()), this, SLOT(addTab())); seq = QKeySequence("Ctrl+t"); sc = new QShortcut(seq, this); connect(sc, SIGNAL (activated()), this, SLOT(addTab())); seq = QKeySequence("Ctrl+w"); sc = new QShortcut(seq, this); connect(sc, SIGNAL (activated()), this, SLOT(closeCurrentTab())); connect(ui->tabs, SIGNAL(currentChanged(int)), this, SLOT(onCurrentTabChanged(int))); connect(ui->tabs, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); icon = QIcon(icon_path + "/cross.png"); ui->closeSearchTB->setIcon(icon); connect(ui->closeSearchTB, SIGNAL(clicked()), this, SLOT(closeSearchPanel())); seq = QKeySequence("Ctrl+f"); sc = new QShortcut(seq, this); connect(sc, SIGNAL (activated()), this, SLOT(openSearchPanel())); seq = QKeySequence("/"); sc = new QShortcut(seq, this); connect(sc, SIGNAL (activated()), this, SLOT(openSearchPanel())); seq = QKeySequence("Esc"); sc = new QShortcut(seq, this); connect(sc, SIGNAL (activated()), this, SLOT(closeSearchPanel())); seq = QKeySequence(Qt::Key_F3); sc = new QShortcut(seq, this); connect(sc, SIGNAL(activated()), this, SLOT(searchNext())); seq = QKeySequence(Qt::SHIFT + Qt::Key_F3); sc = new QShortcut(seq, this); connect(sc, SIGNAL(activated()), this, SLOT(searchPrev())); connect(ui->searchCMB->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(onSearchTextChanged(const QString&))); connect(ui->nextTB, SIGNAL(clicked()), this, SLOT(searchNext())); connect(ui->prevTB, SIGNAL(clicked()), this, SLOT(searchPrev())); connect(ui->searchCMB->lineEdit(), SIGNAL(returnPressed()), this, SLOT(returnPressedInSearch())); seq = QKeySequence("Ctrl+s"); sc = new QShortcut(seq, this); connect(sc, SIGNAL(activated()), this, SLOT(toggleSearchKind())); connect(ui->serverSearchCB, SIGNAL(stateChanged(int)), this, SLOT(onSearchKindChanged(int))); connect(ui->execSearchPB, SIGNAL(clicked()), this, SLOT(serverSearch())); onSearchKindChanged(int(ui->serverSearchCB->checkState())); ui->execSearchPB->hide(); setPlaylist(pl); }
CCustomer::CCustomer(QWidget *parent) : QWidget(parent) , actualRecords(false) , ui(new Ui::CCustomer) , customerDialog(new CCustomerDialog(this)), customer_gDialog(new CCustomer_gDialog(this)) , discountDialog(new CDiscountDialog(this)) , addItem(new CAddItem(this)) , focusedWidget(nullptr) { ui->setupUi(this); // model modelFaces = new QStandardItemModel(this); modelPartner = new QStandardItemModel(this); modelHuman = new QStandardItemModel(this); modelSelectionFaces = new QItemSelectionModel(modelFaces); modelSelectionPartner = new QItemSelectionModel(modelPartner); modelSelectionHuman = new QItemSelectionModel(modelHuman); // create #temporary table QString query ("SELECT * INTO #GroupCustomerDiscounts FROM ViewGroupCustomerDiscounts" "SELECT * INTO #CustomerSubdiller FROM ViewCustomerSubdiller"); QSqlQuery temporary(currentDatabase()); temporary.exec(query); QSplitter *hSplitter = new QSplitter(Qt::Horizontal); QSplitter *vSplitter = new QSplitter(Qt::Vertical); QWidget *w1 = new QWidget(this); QWidget *w2 = new QWidget(this); treeFaces = new QTreeView (this); treePartner = new CCustomerTreeView (this); textEditPartnerComment = new QTextEdit (this); textEditPartnerComment->setMaximumWidth(100); textEditPartnerComment->setReadOnly(true); treeHuman = new CCustomerTreeView (this); textEditHumanComment = new QTextEdit (this); textEditHumanComment->setMaximumWidth(100); textEditHumanComment->setReadOnly(true); QHBoxLayout *hboxPartner = new QHBoxLayout(w1); hboxPartner->setMargin(0); hboxPartner->addWidget(treePartner); hboxPartner->addWidget(textEditPartnerComment); QHBoxLayout *hboxHuman = new QHBoxLayout(w2); hboxHuman->setMargin(0); hboxHuman->addWidget(treeHuman); hboxHuman->addWidget(textEditHumanComment); vSplitter->addWidget(w1); vSplitter->addWidget(w2); vSplitter->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); ui->vLayoutUnionPartnerHuman->addWidget(vSplitter); hSplitter->addWidget(treeFaces); hSplitter->addWidget(vSplitter); hSplitter->setStretchFactor(1, 3); hSplitter->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); ui->hLayoutUnionViews->addWidget(hSplitter); treeFaces->setObjectName("treeViewFaces"); treeFaces->setModel(modelFaces); treeFaces->setSelectionModel(modelSelectionFaces); treeFaces->setEditTriggers(QAbstractItemView::NoEditTriggers); treeFaces->installEventFilter(this); treePartner->setObjectName("treeViewPartner"); treePartner->setRootIsDecorated(false); treePartner->setAlternatingRowColors(true); treePartner->setModel(modelPartner); treePartner->setSelectionModel(modelSelectionPartner); treePartner->setEditTriggers(QAbstractItemView::NoEditTriggers); treePartner->installEventFilter(this); treeHuman->setObjectName("treeViewHuman"); treeHuman->setRootIsDecorated(false); treeHuman->setAlternatingRowColors(true); treeHuman->setModel(modelHuman); treeHuman->setSelectionModel(modelSelectionHuman); treeHuman->setEditTriggers(QAbstractItemView::NoEditTriggers); treeHuman->installEventFilter(this); filter = new CFilter(this); filter->setObjectName("filter"); filter->setPlaceholderText("Введите наименование"); filter->installEventFilter(this); filter->setValidator(new QRegExpValidator(QRegExp(trUtf8("[а-яА-Яa-zA-Z0-9_]+")), this)); ui->hLayoutSearchToItem->addWidget(filter); QToolButton *telephone = new QToolButton(this); QPixmap pixmapTelephone("data/picture/additionally/telephone.png"); telephone->setIcon(QIcon(pixmapTelephone)); telephone->setIconSize(QSize(24, 24)); telephone->setCursor(Qt::PointingHandCursor); telephone->setStyleSheet("QToolButton { border: none; padding: 0px; }"); ui->hLayoutSearchToItem->addWidget(telephone); QToolButton *meeting = new QToolButton(this); QPixmap pixmapMeeting("data/picture/additionally/meeting.png"); meeting->setIcon(QIcon(pixmapMeeting)); meeting->setIconSize(QSize(24, 24)); meeting->setCursor(Qt::PointingHandCursor); meeting->setStyleSheet("QToolButton { border: none; padding: 0px; }"); ui->hLayoutSearchToItem->addWidget(meeting); QToolButton *event = new QToolButton(this); QPixmap pixmapEvent("data/picture/additionally/event.png"); event->setIcon(QIcon(pixmapEvent)); event->setIconSize(QSize(24, 24)); event->setCursor(Qt::PointingHandCursor); event->setStyleSheet("QToolButton { border: none; padding: 0px; }"); ui->hLayoutSearchToItem->addWidget(event); QToolButton *task = new QToolButton(this); QPixmap pixmapTask("data/picture/additionally/task.png"); task->setIcon(QIcon(pixmapTask)); task->setIconSize(QSize(24, 24)); task->setCursor(Qt::PointingHandCursor); task->setStyleSheet("QToolButton { border: none; padding: 0px; }"); ui->hLayoutSearchToItem->addWidget(task); ui->labelCurrentUser->setText(QString("Пользователь: <b><u>" + currentUser() + "</u></b>")); mc.idCustomer = -1; mc.nameCustomer = QString(""); root = new QStandardItem(QString("Заказчики")); root->setIcon(QIcon("data/picture/additionally/root.png")); modelFaces->insertColumns(0, FACES_MODEL_COLUMN_COUNT); modelFaces->setItem(0, 0, root); QFont font(treeFaces->font()); font.setBold (true); modelFaces->setData(modelFaces->index(0, 0), font, Qt::FontRole); modelFaces->setHeaderData(0, Qt::Horizontal, QObject::tr("Наименование")); QVector<int> storage; storage.append(1); storage.append(2); storage.append(3); CDictionaryCore::columnHidden(treeFaces, modelFaces, storage); storage.clear(); root->setChild(modelFaces->rowCount(root->index()), new QStandardItem("Загрузка...")); modelPartner->insertColumns(0, PARTNER_MODEL_COLUMN_COUNT); modelPartner->setHeaderData(0, Qt::Horizontal, "Контрагенты"); modelPartner->setHeaderData(1, Qt::Horizontal, "Клиентский №"); modelPartner->setHeaderData(2, Qt::Horizontal, "Телефон"); modelPartner->setHeaderData(3, Qt::Horizontal, "Город"); modelPartner->setHeaderData(4, Qt::Horizontal, "Web"); modelPartner->setHeaderData(5, Qt::Horizontal, "Руководитель"); modelHuman->insertColumns(0, HUMAN_MODEL_COLUMN_COUNT); modelHuman->setHeaderData(0, Qt::Horizontal, "ФИО"); modelHuman->setHeaderData(1, Qt::Horizontal, "Отдел"); modelHuman->setHeaderData(2, Qt::Horizontal, "Должность"); modelHuman->setHeaderData(3, Qt::Horizontal, "Телефон"); modelHuman->setHeaderData(4, Qt::Horizontal, "Приоритет"); // connect(filter, SIGNAL(textChanged(QString)), SLOT(slotFindCities(QString))); connect(treeFaces, SIGNAL(expanded(QModelIndex)), SLOT(slotFillGroup(QModelIndex))); connect(treeFaces, SIGNAL(collapsed(QModelIndex)), SLOT(slotClearGroup(QModelIndex))); connect(treeFaces, SIGNAL(clicked(QModelIndex)), SLOT(slotFillPartner(QModelIndex))); // connect(treeViewCountry, SIGNAL(clicked(QModelIndex)), // this, SLOT(slotDataChanged(QModelIndex))); // connect(editDialogCountry, SIGNAL(saveDataChanged()), this, SLOT(slotInsertOrUpdateRecords())); // connect(editDialogCity, SIGNAL(saveDataChanged()), this, SLOT(slotInsertOrUpdateRecords())); // connect(addItem->ui->buttonSave, SIGNAL(clicked()), countryDialog, SLOT(show())); connect(addItem->ui->buttonSave, SIGNAL(clicked()), SLOT(slotShowEditDialog())); connect(addItem->ui->buttonSave, SIGNAL(clicked()), addItem, SLOT(close())); actualRecords ? ui->labelViewState->setText(QString(tr("Отображаются записи: <b><u>Актуальные</u></b>"))) : ui->labelViewState->setText(QString(tr("Отображаются записи: <b><u>Все</u></b>"))); }