// --------- FancyLineEdit FancyLineEdit::FancyLineEdit(QWidget *parent) : QLineEdit(parent), d(new FancyLineEditPrivate(this)) { ensurePolished(); updateMargins(); connect(this, SIGNAL(textChanged(QString)), this, SLOT(checkButtons(QString))); connect(d->m_iconbutton[Left], SIGNAL(clicked()), this, SLOT(iconClicked())); connect(d->m_iconbutton[Right], SIGNAL(clicked()), this, SLOT(iconClicked())); }
void MacroItemRect::selectIcon() { qDebug() << iconName << " selected"; QPen pen = this->pen(); pen.setStyle(Qt::SolidLine); this->setPen(pen); emit iconClicked(this); }
AutoFillIcon::AutoFillIcon(QWidget* parent) : ClickableLabel(parent) , m_view(0) { setObjectName("locationbar-autofillicon"); setCursor(Qt::PointingHandCursor); setToolTip(AutoFillWidget::tr("Choose username to login")); setFocusPolicy(Qt::ClickFocus); connect(this, SIGNAL(clicked(QPoint)), this, SLOT(iconClicked())); }
RssIcon::RssIcon(QWidget* parent) : ClickableLabel(parent) , m_view(0) { setObjectName("locationbar-rss-icon"); setCursor(Qt::PointingHandCursor); setFocusPolicy(Qt::ClickFocus); setToolTip(tr("Add RSS from this page...")); connect(this, SIGNAL(clicked(QPoint)), this, SLOT(iconClicked())); }
void TitleWidget::setIcon( Plasma::IconWidget *icon ) { if ( m_icon ) { m_layout->removeItem(m_icon); delete m_icon; } m_icon = icon; connect( icon, SIGNAL(clicked()), this, SIGNAL(iconClicked()) ); m_layout->insertItem( 0, m_icon ); }
void RListWidget::mouseReleaseEvent(QMouseEvent* e) { if (e->x()-iconOffset < iconSize().width()) { QListWidgetItem* item = itemAt(e->pos()); if (item != NULL && item == itemPressed) { emit iconClicked(e->x()-iconOffset, item); } } else { e->ignore(); QListWidget::mouseReleaseEvent(e); } }
bool TextureEditor::OnEvent(const irr::SEvent &event) { if (!state || !state->project || state->settings->getBool("hide_sidebar")) return false; Node *node = state->project->GetCurrentNode(); if (!node) return false; if (event.EventType == EET_MOUSE_INPUT_EVENT && event.MouseInput.Event == EMIE_LMOUSE_LEFT_UP) { unsigned int start_x = state->device->getVideoDriver()->getScreenSize().Width - 256; if (iconClicked(start_x + 96, 70, state->mouse_position)) { TextureDialog::show(state, node, ECS_LEFT); } else if (iconClicked(start_x + 16, 170, state->mouse_position)) { TextureDialog::show(state, node, ECS_TOP); } else if (iconClicked(start_x + 96, 170, state->mouse_position)) { TextureDialog::show(state, node, ECS_FRONT); } else if (iconClicked(start_x + 180, 170, state->mouse_position)) { TextureDialog::show(state, node, ECS_BOTTOM); } else if (iconClicked(start_x + 96, 270, state->mouse_position)) { TextureDialog::show(state, node, ECS_RIGHT); } else if (iconClicked(start_x + 96, 370, state->mouse_position)) { TextureDialog::show(state, node, ECS_BACK); } } return false; }
bool Notification::trayHandler(const MSG& msg) { switch(LOWORD(msg.lParam)) { case WM_LBUTTONUP: { if(iconClicked) { iconClicked(); } break; } case WM_RBUTTONUP: { if(contextMenu) { // Work-around for windows bug (KB135788) ::SetForegroundWindow(parent->handle()); contextMenu(); parent->postMessage(WM_NULL); } break; } case WM_MOUSEMOVE: { if(updateTip) { DWORD now = ::GetTickCount(); if(now - 1000 > lastTick) { updateTip(); lastTick = now; } } break; } case NIN_BALLOONUSERCLICK: { balloons.front().first(); } // fall through case NIN_BALLOONHIDE: // fall through case NIN_BALLOONTIMEOUT: { balloons.pop_front(); if(onlyBalloons && balloons.empty()) { setVisible(false); } break; } } return true; }
SiteIcon::SiteIcon(QupZilla* window, LocationBar* parent) : ToolButton(parent) , p_QupZilla(window) , m_locationBar(parent) , m_view(0) { setObjectName("locationbar-siteicon"); setToolButtonStyle(Qt::ToolButtonIconOnly); setCursor(Qt::ArrowCursor); setToolTip(LocationBar::tr("Show information about this page")); setFocusPolicy(Qt::ClickFocus); connect(this, SIGNAL(clicked()), this, SLOT(iconClicked())); }
BookmarkIcon::BookmarkIcon(QWidget* parent) : ClickableLabel(parent) , m_bookmarks(0) , m_speedDial(mApp->plugins()->speedDial()) , m_view(0) { setObjectName("locationbar-bookmarkicon"); setCursor(Qt::PointingHandCursor); setToolTip(tr("Bookmark this Page")); setFocusPolicy(Qt::ClickFocus); m_bookmarks = mApp->bookmarks(); connect(m_bookmarks, SIGNAL(bookmarkAdded(Bookmarks::Bookmark)), this, SLOT(bookmarkAdded(Bookmarks::Bookmark))); connect(m_bookmarks, SIGNAL(bookmarkDeleted(Bookmarks::Bookmark)), this, SLOT(bookmarkDeleted(Bookmarks::Bookmark))); connect(m_speedDial, SIGNAL(pagesChanged()), this, SLOT(speedDialChanged())); connect(this, SIGNAL(clicked(QPoint)), this, SLOT(iconClicked())); }
Context::AppletToolbarAddItem::AppletToolbarAddItem( QGraphicsItem* parent, Context::Containment* cont, bool fixedAdd ) : AppletToolbarBase( parent ) , m_iconPadding( 0 ) , m_fixedAdd( fixedAdd ) , m_showingAppletExplorer( false ) , m_cont( cont ) , m_icon( 0 ) , m_label( 0 ) { QAction* listAdd = new QAction( i18n( "Add Applets..." ), this ); listAdd->setIcon( KIcon( "list-add" ) ); listAdd->setVisible( true ); listAdd->setEnabled( true ); connect( listAdd, SIGNAL( triggered() ), this, SLOT( iconClicked() ) ); m_icon = new Plasma::IconWidget( this ); m_icon->setAction( listAdd ); m_icon->setText( QString() ); m_icon->setToolTip( listAdd->text() ); m_icon->setDrawBackground( false ); m_icon->setOrientation( Qt::Horizontal ); QSizeF iconSize; if( m_fixedAdd ) iconSize = m_icon->sizeFromIconSize( 22 ); else iconSize = m_icon->sizeFromIconSize( 11 ); m_icon->setMinimumSize( iconSize ); m_icon->setMaximumSize( iconSize ); m_icon->resize( iconSize ); m_icon->setZValue( zValue() + 1 ); m_label = new QGraphicsSimpleTextItem( i18n( "Add Applet..." ), this ); m_label->hide(); if( m_cont ) connect( m_cont->view(), SIGNAL( appletExplorerHid() ), this, SLOT( appletExplorerHid() ) ); if( m_fixedAdd ) setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); else setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); // resize( QSizeF( 18, 24 ) ); }
void TestMpVolumeSlider::testMuteIconClicked() { mTest->mEngineMuted = false; mTest->mEngineVolumeLevel = 20; mTest->mEngineVolumeMax = 100; mTest->initializeVolumeSliderPopup(); connect( this, SIGNAL( triggerIconClicked() ), mTest->mVolumeSliderPopup, SIGNAL( iconClicked() ) ); mTest->mVolumeSliderPopup->setValue( 0 ); emit triggerIconClicked(); QCOMPARE( mTest->mMpEngine->iMediaCommandReceived, CmdMuteVolume ); QVERIFY( mTest->mEngineMuted ); mTest->mVolumeSliderPopup->setValue( 1 ); emit triggerIconClicked(); QCOMPARE( mTest->mMpEngine->iMediaCommandReceived, CmdUnmuteVolume ); QVERIFY( !mTest->mEngineMuted ); }
void MainWindow::connectSignalsAndSlots() { //if track info emit e_dane run update function connect(info, SIGNAL(dataReady()), this, SLOT(update())); //this function load actual track image to label connect(load, SIGNAL(image(QPixmap*)), this, SLOT(image(QPixmap*))); //this function load next track image to label connect(loadNext, SIGNAL(image(QPixmap*)), this, SLOT(imageNext(QPixmap*))); //proxy setup connect(proxyDial, SIGNAL(data_ok(QNetworkProxy)), this, SLOT(setProxy(QNetworkProxy))); connect(ui->play_pause, SIGNAL(clicked()), this, SLOT(play_pause())); connect(ui->actionO_programie, SIGNAL(triggered()), this, SLOT(about())); connect(&tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconClicked(QSystemTrayIcon::ActivationReason))); //play on enter key push connect(ui->listWidget, SIGNAL(activated(QModelIndex)), this, SLOT(on_listWidget_doubleClicked(QModelIndex))); connect(ui->actionOpcje, SIGNAL(triggered()), this, SLOT(options())); }
// --------- FancyLineEdit FancyLineEdit::FancyLineEdit(QWidget *parent) : QLineEdit(parent), m_d(new FancyLineEditPrivate(this)) { // KDE has custom icons for this. Notice that icon namings are counter intuitive // If these icons are not avaiable we use the freedesktop standard name before // falling back to a bundled resource QIcon icon = QIcon::fromTheme(layoutDirection() == Qt::LeftToRight ? QLatin1String("edit-clear-locationbar-rtl") : QLatin1String("edit-clear-locationbar-ltr"), QIcon::fromTheme("edit-clear", QIcon(QLatin1String(":/core/images/editclear.png")))); m_d->m_iconbutton->installEventFilter(m_d); m_d->m_iconbutton->setIcon(icon); ensurePolished(); setSide(Left); connect(this, SIGNAL(textChanged(QString)), this, SLOT(checkButton(QString))); connect(m_d->m_iconbutton, SIGNAL(clicked()), this, SLOT(iconClicked())); }
int QDesktopViewWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QListWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: iconClicked((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break; case 1: layoutDirection(); break; case 2: populatedDesktop(); break; case 3: resizeIcons(); break; case 4: createFolder(); break; case 5: createLauncher(); break; case 6: createEmptyFile(); break; case 7: showDesktopIcons(); break; case 8: execDesktopSettings(); break; default: ; } _id -= 9; } return _id; }
Widget::Widget() { // This class is the host of the whole application. This is BAD. Needs to be rectified. Should split this up into either: More classes OR More Files firstComp = NULL; //Setup the linked list //Spawn a QMainWindow, and set its attributes mainWindow = new QMainWindow(); mainWindow->resize(400, 400); mainWindow->setWindowTitle("Lan Party Manager " + releaseType + " " + releaseVer); setup = new QSettings(QSettings::IniFormat, QSettings::SystemScope, "Alldritt Coding", "LanParty Manager", this); QStringList keys = setup->allKeys(); if(keys.length() != 8) { setup->clear(); setup->setValue("udpBroadcast", 1000); setup->setValue("tcpBroadcast", 5000); setup->setValue("udpPort", 45454); setup->setValue("tcpPort", 1337); setup->setValue("debug", false); setup->setValue("releaseType", releaseType); setup->setValue("releaseVer", releaseVer); setup->setValue("networkUpdateRate", 1000); } else { udpBroadcastRate = setup->value("udpBroadcast", 1000).toInt(); tcpCheckRate = setup->value("tcpBroadcast", 5000).toInt(); standardUdpPort = setup->value("udpPort", 45454).toInt(); standardTcpPort = setup->value("tcpPort", 1337).toInt(); debugMode = setup->value("debug", false).toBool(); //releaseType = setup->value("releaseType", "").toString(); //releaseVer = setup->value("releaseVer", "").toString(); networkUpdateRate = setup->value("networkUpdateRate", 1000).toInt(); } settings = new QWidget(mainWindow, Qt::Dialog); settings->resize(300, 300); settings->setWindowTitle("Settings"); settings->hide(); QLabel * la = new QLabel(settings); la->move(15, 15); la->setText("UDP Broadcast Delay"); QLabel * lb = new QLabel(settings); lb->move(15, 45); lb->setText("TCP Broadcast Delay"); QLabel * lc = new QLabel(settings); lc->move(15, 75); lc->setText("Default UDP Port (Advanced)"); QLabel * ld = new QLabel(settings); ld->move(15, 105); ld->setText("Default TCP Port (Advanced)"); QLabel * le = new QLabel(settings); le->move(15, 165); le->setText("Debug Mode"); QLabel * lf = new QLabel(settings); lf->move(15, 135); lf->setText("Total Bytes Refresh Rate"); uPort = new QLineEdit(settings); uPort->setGeometry(200, 75, 50, 20); uPort->setText(QString().number(standardUdpPort)); tPort = new QLineEdit(settings); tPort->setGeometry(200, 105, 50, 20); tPort->setText(QString().number(standardTcpPort)); uDelay = new QLineEdit(settings); uDelay->setGeometry(200, 15, 50, 20); uDelay->setText(QString().number(udpBroadcastRate)); tDelay = new QLineEdit(settings); tDelay->setGeometry(200, 45, 50, 20); tDelay->setText(QString().number(tcpCheckRate)); nDelay = new QLineEdit(settings); nDelay->setGeometry(200, 135, 50, 20); nDelay->setText(QString().number(networkUpdateRate)); debugOn = new QCheckBox(settings); debugOn->move(200, 165); debugOn->setChecked(debugMode); QPushButton * apply = new QPushButton(settings); apply->setGeometry(200, 200, 60, 30); apply->setText("Apply"); QObject::connect(apply, SIGNAL(clicked()), this, SLOT(apply())); QWidget * passWindow = new QWidget(mainWindow, Qt::Tool); passWindow->resize(200, 80); passWindow->hide(); QLabel * passLabel = new QLabel(passWindow); passLabel->move(50, 10); passLabel->setText("Enter Password"); passBox = new QLineEdit(passWindow); passBox->setGeometry(40, 25, 130, 20); QPushButton * enter = new QPushButton(passWindow); enter->setGeometry(40, 50, 50, 25); enter->setText("Enter"); QObject::connect(enter, SIGNAL(clicked()), this, SLOT(passEnter())); QObject::connect(enter, SIGNAL(clicked()), passWindow, SLOT(hide())); QObject::connect(passBox, SIGNAL(returnPressed()), this, SLOT(passEnter())); QObject::connect(passBox, SIGNAL(returnPressed()), passWindow, SLOT(hide())); icon = new QIcon(":/images/icon.png"); sysIcon = new QSystemTrayIcon(*icon, this); sysIcon->show(); sysMenu = new QMenu(mainWindow); QAction * exitAction = sysMenu->addAction("Exit"); sysIcon->setContextMenu(sysMenu); connect(exitAction, SIGNAL(triggered(bool)), qApp, SLOT(quit())); connect(exitAction, SIGNAL(triggered(bool)), this, SLOT(close())); bool success = connect(sysIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconClicked(QSystemTrayIcon::ActivationReason))); if(success != true) { sysIcon->showMessage("System Tray Error", "Window Respawn Connection Failed", QSystemTrayIcon::Information, 10000 ); } QMenu* file = mainWindow->menuBar()->addMenu(tr("&File")); QMenu* help = mainWindow->menuBar()->addMenu(tr("&Help")); QAction* exitAct = new QAction(tr("&Exit"), this); exitAct->setStatusTip(tr("Quit")); connect(exitAct, SIGNAL(triggered()), qApp, SLOT(quit())); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); QAction* settingAct = new QAction(tr("&Settings"), this); settingAct->setStatusTip(tr("Access the Settings page")); connect(settingAct, SIGNAL(triggered()), this, SLOT(settingsWindow())); QAction* aboutQtAct = new QAction(tr("About &Qt"), this); aboutQtAct->setStatusTip(tr("Show the Qt library's About box")); connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); QAction* aboutAct = new QAction(tr("&About"), this); aboutAct->setStatusTip(tr("Show the About box")); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); help->addAction(aboutQtAct); help->addAction(aboutAct); file->addAction(settingAct); file->addAction(exitAct); mainWindow->show(); server = new QPushButton(mainWindow); client = new QPushButton(mainWindow); log = new QFile("log.txt"); currentTime = new QDateTime(); //create the log timestamp *currentTime = QDateTime::currentDateTime(); //get system time if(!log->open(QIODevice::ReadWrite|QIODevice::Append)) { QMessageBox::information(0, "Error", "Can't open logfile. Reason: " + log->errorString()); } if(debugMode) { writeLog("LanMan " + releaseType + " " + releaseVer + " Logfile Start"); writeLog("Time Format is: DD/MM/YYYY - HOUR:MIN:SEC AM/PM"); } server->setGeometry(10, 30, 100, 30); client->setGeometry(290, 30, 100, 30); server->setText("SERVER MODE"); client->setText("CLIENT MODE"); client->show(); server->show(); connect(client, SIGNAL(released()), this, SLOT(startClient())); connect(server, SIGNAL(released()), passWindow, SLOT(show())); mainLabel = new QLabel("", mainWindow); mainLabel->move(165, 40); mainLabel->show(); udpSocket = new QUdpSocket(this); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); mainWindow = this; trayIconMenu = new QMenu(this); restoreAction = new QAction(tr("Restore"), this); closeAction = new QAction(tr("Quit ckb"), this); trayIconMenu->addAction(restoreAction); trayIconMenu->addAction(closeAction); trayIcon = new QSystemTrayIcon(QIcon(":/img/ckb-logo.png"), this); trayIcon->setContextMenu(trayIconMenu); if(!CkbSettings::get("Program/SuppressTrayIcon").toBool()) trayIcon->show(); #ifdef Q_OS_MACX // Make a custom "Close" menu action for OSX, as the default one brings up the "still running" popup unnecessarily QMenuBar* menuBar = new QMenuBar(this); setMenuBar(menuBar); this->menuBar()->addMenu("ckb")->addAction(closeAction); #else // On linux, add a handler for Ctrl+Q new QShortcut(QKeySequence("Ctrl+Q"), this, SLOT(quitApp())); #endif connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(quitApp())); connect(closeAction, SIGNAL(triggered()), this, SLOT(quitApp())); connect(restoreAction, SIGNAL(triggered()), this, SLOT(showWindow())); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconClicked(QSystemTrayIcon::ActivationReason))); connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(cleanup())); eventTimer = new QTimer(this); eventTimer->setTimerType(Qt::PreciseTimer); connect(eventTimer, SIGNAL(timeout()), this, SLOT(timerTick())); eventTimer->start(1000 / 60); QCoreApplication::setOrganizationName("ckb"); ui->tabWidget->addTab(settingsWidget = new SettingsWidget(this), configLabel); settingsWidget->setVersion("ckb " CKB_VERSION_STR); ckbGuiVersion = PARSE_CKB_VERSION(CKB_VERSION_STR); scanKeyboards(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); mainWindow = this; // Start device manager KbManager::init(CKB_VERSION_STR); connect(KbManager::kbManager(), SIGNAL(kbConnected(Kb*)), this, SLOT(addDevice(Kb*))); connect(KbManager::kbManager(), SIGNAL(kbDisconnected(Kb*)), this, SLOT(removeDevice(Kb*))); connect(KbManager::kbManager(), SIGNAL(versionUpdated()), this, SLOT(updateVersion())); connect(KbManager::scanTimer(), SIGNAL(timeout()), this, SLOT(timerTick())); // Set up tray icon restoreAction = new QAction(tr("Restore"), this); closeAction = new QAction(tr("Quit ckb"), this); #ifdef USE_LIBAPPINDICATOR QString desktop = std::getenv("XDG_CURRENT_DESKTOP"); unityDesktop = (desktop.toLower() == "unity"); if(unityDesktop){ trayIcon = 0; indicatorMenu = gtk_menu_new(); indicatorMenuRestoreItem = gtk_menu_item_new_with_label("Restore"); indicatorMenuQuitItem = gtk_menu_item_new_with_label("Quit ckb"); gtk_menu_shell_append(GTK_MENU_SHELL(indicatorMenu), indicatorMenuRestoreItem); gtk_menu_shell_append(GTK_MENU_SHELL(indicatorMenu), indicatorMenuQuitItem); g_signal_connect(indicatorMenuQuitItem, "activate", G_CALLBACK(quitIndicator), this); g_signal_connect(indicatorMenuRestoreItem, "activate", G_CALLBACK(restoreIndicator), this); gtk_widget_show(indicatorMenuRestoreItem); gtk_widget_show(indicatorMenuQuitItem); indicator = app_indicator_new("ckb", "indicator-messages", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); app_indicator_set_status(indicator, APP_INDICATOR_STATUS_ACTIVE); app_indicator_set_menu(indicator, GTK_MENU(indicatorMenu)); app_indicator_set_icon(indicator, "ckb"); } else #endif // USE_LIBAPPINDICATOR { trayIconMenu = new QMenu(this); trayIconMenu->addAction(restoreAction); trayIconMenu->addAction(closeAction); trayIcon = new QSystemTrayIcon(QIcon(":/img/ckb-logo.png"), this); trayIcon->setContextMenu(trayIconMenu); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconClicked(QSystemTrayIcon::ActivationReason))); } toggleTrayIcon(!CkbSettings::get("Program/SuppressTrayIcon").toBool()); #ifdef Q_OS_MACX // Make a custom "Close" menu action for OSX, as the default one brings up the "still running" popup unnecessarily QMenuBar* menuBar = new QMenuBar(this); setMenuBar(menuBar); this->menuBar()->addMenu("ckb")->addAction(closeAction); #else // On linux, add a handler for Ctrl+Q new QShortcut(QKeySequence("Ctrl+Q"), this, SLOT(quitApp())); #endif connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(quitApp())); connect(closeAction, SIGNAL(triggered()), this, SLOT(quitApp())); connect(restoreAction, SIGNAL(triggered()), this, SLOT(showWindow())); connect(qApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(stateChange(Qt::ApplicationState))); connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(cleanup())); ui->tabWidget->addTab(settingsWidget = new SettingsWidget(this), configLabel); settingsWidget->setVersion("ckb " CKB_VERSION_STR); }
void IconItem::release() { if(isUnderMouse() && is_selectable_) emit iconClicked(); setPixmap(info_.icon_img_); }