void EmojiWidget::setVisible(bool visible) { QFrame::setVisible(visible); if (visible) { QLayout *gridLayout = scrollArea->widget()->layout(); if (emojiManager->hasRecents()) showCategory("Recent"); else if (!gridLayout) showCategory("Smileys & People"); } }
void NBCategoryMenu::populateMenu() { showAct = new QAction( "Visible", this ); connect( showAct, SIGNAL( triggered() ), this, SLOT( showCategory() ) ); addAction( showAct ); foldAct = new QAction( "Folded", this ); connect( foldAct, SIGNAL( triggered() ), this, SLOT( foldCategory() ) ); addAction( foldAct ); hideAct = new QAction( "Hidden", this ); connect( hideAct, SIGNAL( triggered() ), this, SLOT( hideCategory() ) ); addAction( hideAct ); addSeparator(); selAct = new QAction( QIcon( ":/icons/select1.png" ), "Select All", this ); addAction( selAct ); connect( selAct, SIGNAL( triggered() ), this, SLOT( manageSelection() ) ); uselAct = new QAction( QIcon(), "Deselect All", this ); addAction( uselAct ); connect( uselAct, SIGNAL( triggered() ), this, SLOT( manageSelection() ) ); addSeparator(); propAct = new QAction( QIcon( ":/icons/props.png" ), "Properties", this ); connect( propAct, SIGNAL( triggered() ), this, SLOT( showProperties() ) ); addAction( propAct ); };
void selectedRowsChanged (int row) override { if (row == -1) return; if (selectedCategory.isEmpty()) showCategory (JUCEDemos::getCategories()[row].name); else demoHolder.setDemo (selectedCategory, row); }
QLayout *EmojiWidget::createCategoriesLayout() { auto hLayout = new QHBoxLayout(); for (auto category : emojiManager->getCategories()) { auto button = new QToolButton(); button->setToolTip(category); QString imageName = category.split(" ").at(0); // at(0) always return at least the original string QString iconPath = QString(":/emoji/categories/%1.png").arg(imageName); button->setIcon(QPixmap(iconPath)); connect(button, &QToolButton::clicked, [=](){ showCategory(category); }); hLayout->addWidget(button, 1, Qt::AlignCenter); if (category == "Recent") recentButton = button; } return hLayout; }
MainController::MainController(): m_mw(new MainWindow), m_search(m_mw) { connect(m_mw, SIGNAL(s_save(QString)), this, SLOT(save(QString))); connect(m_mw, SIGNAL(s_load(QString)), this, SLOT(load(QString))); connect(m_mw, SIGNAL(s_newBase()), this, SLOT(newBase())); connect(m_mw, SIGNAL(s_addCategory(QString)), this, SLOT(newCategory(QString))); connect(m_mw, SIGNAL(s_removeCategory(QString)), this, SLOT(removeCategory(QString))); connect(m_mw, SIGNAL(s_seeCategory()), this, SLOT(editCategory())); connect(m_mw, SIGNAL(s_showCategory()), this, SLOT(showCategory())); connect(m_mw, SIGNAL(s_addMedia(QString)), this, SLOT(newMedia(QString))); connect(m_mw, SIGNAL(s_removeMedia(QString,QString)), this, SLOT(removeMedia(QString,QString))); connect(m_mw, SIGNAL(s_seeMedia()), this, SLOT(editMedia())); connect(m_mw, SIGNAL(s_showUser()), this, SLOT(setUser())); connect(m_mw, SIGNAL(s_search()), this, SLOT(search())); connect(&m_search, SIGNAL(s_find(QList<MediaSPointer>)), this, SLOT(showSearch(QList<MediaSPointer>))); connect(m_mw, SIGNAL(s_settings()), this, SLOT(settings())); m_mw->setShortcut(SettingsController::settings()); SettingsController artemis; artemis.newSettings(SettingsController::settings()); if(UserController::userCount() == 0) UserController().exec(); else UserController::connectUser(); }
void NBCategoryMenu::showCategory() { emit showCategory( mCategory ); };
bool ConstantCompletion::eventFilter(QObject* object, QEvent* event) { if (event->type() == QEvent::Hide) { emit canceledCompletion(); return true; } if (object == m_constantWidget) { if (event->type() == QEvent::KeyPress) { int key = static_cast<QKeyEvent*>(event)->key(); switch (key) { case Qt::Key_Enter: case Qt::Key_Return: case Qt::Key_Tab: doneCompletion(); return true; case Qt::Key_Left: showCategory(); return true; case Qt::Key_Right: case Qt::Key_Up: case Qt::Key_Down: case Qt::Key_Home: case Qt::Key_End: case Qt::Key_PageUp: case Qt::Key_PageDown: return false; } if (key != Qt::Key_Escape) QApplication::sendEvent(m_editor, event); emit canceledCompletion(); return true; } } if (object == m_categoryWidget) { if (event->type() == QEvent::KeyPress) { int key = static_cast<QKeyEvent*>(event)->key(); switch (key) { case Qt::Key_Enter: case Qt::Key_Return: case Qt::Key_Right: showConstants(); return true; case Qt::Key_Up: case Qt::Key_Down: case Qt::Key_Home: case Qt::Key_End: case Qt::Key_PageUp: case Qt::Key_PageDown: return false; } if (key != Qt::Key_Escape) QApplication::sendEvent(m_editor, event); emit canceledCompletion(); return true; } } return false; }