void UIMachineWindowSeamless::sltRevokeWindowActivation() { /* Make sure window is visible: */ if (!isVisible() || isMinimized()) return; /* Revoke stolen activation: */ #ifdef Q_WS_X11 raise(); #endif /* Q_WS_X11 */ activateWindow(); }
void Player::onLengthChanged(int len) { if (len == 0) //playing TV ui->progressBar->setEnabled(false); else //playing video { ui->progressBar->setEnabled(true); ui->progressBar->setMaximum(len / MPlayer::UPDATE_FREQUENCY); } activateWindow(); raise(); }
/*! activate the panel and set focus specified widget when mouse enters */ void TPanel::enterEvent(QEvent *event) { // Only when Toonz application is active if (qApp->activeWindow()) { widgetFocusOnEnter(); // Some panels (e.g. Viewer, StudioPalette, Palette, ColorModel) are // activated when mouse enters. Viewer is activatable only when being // docked. if (isActivatableOnEnter()) activateWindow(); event->accept(); } else event->accept(); }
void BitcoinGUI::toggleHidden() { // activateWindow() (sometimes) helps with keyboard focus on Windows if (isHidden()) { show(); activateWindow(); } else if (isMinimized()) { showNormal(); activateWindow(); } else if (GUIUtil::isObscured(this)) { raise(); activateWindow(); } else hide(); }
void MainWindow::forceActivateWindow() { #ifndef Q_WS_MAC #ifdef HAVE_KDE const int currentDesktop = KWindowSystem::currentDesktop(); KWindowSystem::setOnDesktop( winId(), currentDesktop ); KWindowSystem::forceActiveWindow( winId() ); #else activateWindow(); #endif #endif }
void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason) { if (reason==QSystemTrayIcon::Trigger) { if (isHidden()) { show(); activateWindow(); } else hide(); } }
void screen::activate() { if (bActivated == false){ nInput2 = nInput = 0xffff; // no key pressed bWasActivated = bActivated = true; show(); activateWindow(); if (bWasActivated) clearLastLine(); } else show(); }
void GameDatabaseManager::importPgnFile(const QString& fileName) { PgnImporter* pgnImporter = new PgnImporter(fileName); connect(pgnImporter, SIGNAL(databaseRead(PgnDatabase*)), this, SLOT(addDatabase(PgnDatabase*))); auto dlg = new ImportProgressDialog(pgnImporter); dlg->show(); dlg->raise(); dlg->activateWindow(); QThreadPool::globalInstance()->start(pgnImporter); }
void KviWindow::autoRaise() { if(!mdiParent()) { raise(); activateWindow(); } if(m_pFocusHandler) m_pFocusHandler->setFocus(); else setFocus(); }
void B9Terminal::onScreenCountChanged(int iCount){ QString sVideo = "Disconnected or Primary Monitor"; if(pProjector) { delete pProjector; pProjector = NULL; if(pPrinterComm->getProjectorStatus()==B9PrinterStatus::PS_ON) if(!isEnabled())emit signalAbortPrint("Print Aborted: Connection to Projector Lost or Changed During Print Cycle"); } pProjector = new B9Projector(true, 0,Qt::WindowStaysOnTopHint); makeProjectorConnections(); int i=iCount; int screenCount = m_pDesktop->screenCount(); QRect screenGeometry; if(m_bUsePrimaryMonitor) { screenGeometry = m_pDesktop->screenGeometry(0); } else{ for(i=screenCount-1;i>= 0;i--) { screenGeometry = m_pDesktop->screenGeometry(i); if(screenGeometry.width() == pPrinterComm->getNativeX() && screenGeometry.height() == pPrinterComm->getNativeY()) { //Found the projector! sVideo = "Connected to Monitor: " + QString::number(i+1); m_bNeedsWarned = true; break; } } } if(i<=0||m_bUsePrimaryMonitor)m_bPrimaryScreen = true; else m_bPrimaryScreen = false; emit updateProjectorOutput(sVideo); pProjector->setShowGrid(true); pProjector->setCPJ(NULL); emit sendStatusMsg("B9Creator - Idle"); pProjector->setGeometry(screenGeometry); if(!m_bPrimaryScreen){ pProjector->showFullScreen(); // Only show it if it is a secondary monitor pProjector->hide(); activateWindow(); // if not using primary monitor, take focus back to here. } else if(m_bPrintPreview||(pPrinterComm->getProjectorStatus() != B9PrinterStatus::PS_OFF && pPrinterComm->getProjectorStatus() != B9PrinterStatus::PS_COOLING && pPrinterComm->getProjectorStatus() != B9PrinterStatus::PS_UNKNOWN)) { // if the projector is not turned off, we better put up the blank screen now! pProjector->showFullScreen(); } //else warnSingleMonitor(); }
dFilter::dFilter( dUpload *d ) : m_dupload( d ) { ui.setupUi( this ); setAttribute( Qt::WA_DeleteOnClose ); setAttribute( Qt::WA_QuitOnClose, false ); QPixmap pixmap = QPixmap::fromImage( QApplication::clipboard()->image() ); if ( pixmap.isNull() && QApplication::clipboard()->mimeData()->hasUrls() ) pixmap.load( QApplication::clipboard()->mimeData()->urls()[0].toLocalFile() ); if ( pixmap.isNull() ) { pixmap = dDesktopManager::instance()->makeScreenshot(); } if ( pixmap.isNull() ) { close(); return; } m_original = pixmap; m_current = m_original; ui.image->setPixmap(m_current.scaled(ui.image->width(), ui.image->height(), Qt::KeepAspectRatio)); ui.filterList->setIconSize(QSize(200, 200)); loadFilters(); connect(ui.filterList, &QListWidget::itemSelectionChanged, this, &dFilter::filterActivated); QPoint window_pos = dDesktopManager::instance()->getScreenCoord( dDesktopManager::instance()->getPrimaryScreen() ); move( window_pos ); showMaximized(); #if defined( Q_WS_X11 ) XClientMessageEvent xev; xev.type = ClientMessage; xev.window = winId(); xev.message_type = XInternAtom( QX11Info::display(), "_NET_ACTIVE_WINDOW", False ); xev.format = 32; xev.data.l[0] = 2; xev.data.l[1] = QX11Info::appUserTime(); XSendEvent( QX11Info::display(), QX11Info::appRootWindow(), False, ( SubstructureNotifyMask | SubstructureRedirectMask ), ( XEvent * ) &xev ); #else activateWindow(); raise(); #endif }
Xml_Generator::Xml_Generator(QWidget * parent, Qt::WindowFlags flags) : QMainWindow(parent,flags) { createMenu(); activateWindow(); }
void MainWindow::trayActivated(QSystemTrayIcon::ActivationReason reason) { if ( reason != QSystemTrayIcon::DoubleClick ) return; if ( isHidden() ) { show(); activateWindow(); _trayIcon->hide(); } else placeToTray(); }
void BrowsingLibrary::showRSS(BrowserWindow* window) { ui->tabs->SetCurrentIndex(2); show(); m_rssManager->setMainWindow(window); if (!m_rssLoaded) { m_rssManager->refreshTable(); m_rssLoaded = true; } raise(); activateWindow(); }
void QgsColorButton::showColorDialog() { QgsPanelWidget *panel = QgsPanelWidget::findParentPanel( this ); if ( panel && panel->dockMode() ) { QColor currentColor = color(); QgsCompoundColorWidget *colorWidget = new QgsCompoundColorWidget( panel, currentColor, QgsCompoundColorWidget::LayoutVertical ); colorWidget->setPanelTitle( mColorDialogTitle ); colorWidget->setAllowOpacity( mAllowOpacity ); if ( currentColor.isValid() ) { colorWidget->setPreviousColor( currentColor ); } connect( colorWidget, &QgsCompoundColorWidget::currentColorChanged, this, &QgsColorButton::setValidTemporaryColor ); panel->openPanel( colorWidget ); return; } QColor newColor; QgsSettings settings; // first check if we need to use the limited native dialogs bool useNative = settings.value( QStringLiteral( "qgis/native_color_dialogs" ), false ).toBool(); if ( useNative ) { // why would anyone want this? who knows.... maybe the limited nature of native dialogs helps ease the transition for MapInfo users? newColor = QColorDialog::getColor( color(), this, mColorDialogTitle, mAllowOpacity ? QColorDialog::ShowAlphaChannel : ( QColorDialog::ColorDialogOption )0 ); } else { QgsColorDialog dialog( this, nullptr, color() ); dialog.setTitle( mColorDialogTitle ); dialog.setAllowOpacity( mAllowOpacity ); if ( dialog.exec() ) { newColor = dialog.color(); } } if ( newColor.isValid() ) { setValidColor( newColor ); } // reactivate button's window activateWindow(); }
//===================================================================================== void statswinimpl::stayontopToggle(bool c) { if (c) setWindowFlags(Qt::SubWindow | Qt::WindowStaysOnTopHint); else setWindowFlags(Qt::SubWindow); if (isHidden() || !isActiveWindow()){ show(); activateWindow(); raise(); } QSettings settings("godville.net", "godvilleQT"); restoreGeometry(settings.value("statWinGeometry").toByteArray()); }
void UIMachineWindowFullscreen::sltRevokeFocus() { /* Make sure window is visible: */ if (!isVisible()) return; #if defined(Q_WS_WIN) /* Revoke stolen focus: */ m_pMachineView->setFocus(); #elif defined(Q_WS_MAC) || defined(Q_WS_X11) /* Revoke stolen activation: */ activateWindow(); #endif /* Q_WS_MAC || Q_WS_X11 */ }
void MainWindow::activate() { setVisible(true); tray_icon_->Hide(); activateWindow(); #ifdef _WIN32 ShowWindow((HWND)winId(), get_gui_settings()->get_value<bool>(settings_window_maximized, false) ? SW_MAXIMIZE : SW_RESTORE); SetWindowPos((HWND)Shadow_->winId(), (HWND)winId(), 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); #endif //_WIN32 #ifdef __APPLE__ mac_support_->activateWindow(winId()); mac_support_->updateMainMenu(); #endif //__APPLE__ }
void QtChatTabs::handleWantsToActivate() { QtTabbable* widget = qobject_cast<QtTabbable*>(sender()); Q_ASSERT(widget); //Un-minimize and bring to front. setWindowState(windowState() & ~Qt::WindowMinimized); setWindowState(windowState() | Qt::WindowActive); show(); widget->show(); tabs_->setCurrentWidget(widget); handleTabTitleUpdated(widget); widget->setFocus(); raise(); activateWindow(); }
void PopupMenu::showMenu(const QPoint &p, PopupMenu *parent, PressSource source) { _parent = parent; QPoint w = p - QPoint(0, _padding.top()); QRect r = App::app() ? App::app()->desktop()->screenGeometry(p) : QDesktopWidget().screenGeometry(p); if (rtl()) { if (w.x() - width() < r.x() - _padding.left()) { if (_parent && w.x() + _parent->width() - _padding.left() - _padding.right() + width() - _padding.right() <= r.x() + r.width()) { w.setX(w.x() + _parent->width() - _padding.left() - _padding.right()); } else { w.setX(r.x() - _padding.left()); } } else { w.setX(w.x() - width()); } } else { if (w.x() + width() - _padding.right() > r.x() + r.width()) { if (_parent && w.x() - _parent->width() + _padding.left() + _padding.right() - width() + _padding.right() >= r.x() - _padding.left()) { w.setX(w.x() + _padding.left() + _padding.right() - _parent->width() - width() + _padding.left() + _padding.right()); } else { w.setX(r.x() + r.width() - width() + _padding.right()); } } } if (w.y() + height() - _padding.bottom() > r.y() + r.height()) { if (_parent) { w.setY(r.y() + r.height() - height() + _padding.bottom()); } else { w.setY(p.y() - height() + _padding.bottom()); } } if (w.y() < r.y()) { w.setY(r.y()); } move(w); _mouseSelection = (source == PressSourceMouse); setSelected((source == PressSourceMouse || _actions.isEmpty()) ? -1 : 0); psUpdateOverlayed(this); show(); psShowOverAll(this); windowHandle()->requestActivate(); activateWindow(); if (_a_hide.animating()) { _a_hide.stop(); _cache = QPixmap(); } a_opacity = anim::fvalue(1, 1); }
void BrowsingLibrary::showHistory(QupZilla* mainClass) { ui->tabs->SetCurrentIndex(0); show(); m_historyManager->setMainWindow(mainClass); if (!m_historyLoaded) { m_historyManager->refreshTable(); m_historyLoaded = true; } raise(); activateWindow(); }
bool MainWindow::showResource(const QVariantMap &resource) { clearWindows(); activateWindow(); const QVariant service = resource.value("service"); if (service != Settings::currentService()) { setService(service); } return QMetaObject::invokeMethod(centralWidget(), "showResource", Qt::QueuedConnection, Q_ARG(QString, resource.value("type").toString()), Q_ARG(QString, resource.value("id").toString())); }
void BrowsingLibrary::showBookmarks(QupZilla* mainClass) { ui->tabs->SetCurrentIndex(1); show(); m_bookmarksManager->setMainWindow(mainClass); if (!m_bookmarksLoaded) { m_bookmarksManager->refreshTable(); m_bookmarksLoaded = true; } raise(); activateWindow(); }
void LumaMixTransition::on_lumaCombo_activated(int index) { if (index == kLumaComboDissolveIndex || index == kLumaComboCutIndex) { on_invertCheckBox_clicked(false); ui->invertCheckBox->setChecked(false); } ui->invertCheckBox->setEnabled( index != kLumaComboDissolveIndex && index != kLumaComboCutIndex); ui->softnessSlider->setEnabled( index != kLumaComboDissolveIndex); ui->softnessSpinner->setEnabled(index != kLumaComboDissolveIndex); QScopedPointer<Mlt::Transition> transition(getTransition("luma")); if (transition && transition->is_valid()) { if (index == kLumaComboDissolveIndex) { transition->set("resource", ""); ui->softnessLabel->setText(tr("Softness")); } else if (index == kLumaComboCutIndex) { // Cut ui->softnessLabel->setText(tr("Position")); ui->softnessSlider->setValue(50); } else if (index == kLumaComboCustomIndex) { ui->softnessLabel->setText(tr("Softness")); // Custom file QString path = Settings.openPath(); #ifdef Q_OS_MAC path.append("/*"); #endif QString filename = QFileDialog::getOpenFileName(this, tr("Open File"), path, tr("Images (*.bmp *.jpeg *.jpg *.pgm *.png *.svg *.tga *.tif *.tiff);;All Files (*)")); activateWindow(); if (!filename.isEmpty()) { transition->set("resource", filename.toUtf8().constData()); MAIN.getHash(*transition); } } else { ui->softnessLabel->setText(tr("Softness")); transition->set("resource", QString("%luma%1.pgm").arg(index - 1, 2, 10, QChar('0')).toLatin1().constData()); } if (qstrcmp(transition->get("resource"), "")) { transition->set("progressive", 1); if (index == kLumaComboCutIndex) { transition->set("invert", 0); transition->set("softness", 0); } else { transition->set("invert", ui->invertCheckBox->isChecked()); transition->set("softness", ui->softnessSlider->value() / 100.0); } } updateCustomLumaLabel(*transition); MLT.refreshConsumer(); } }
void QgsCompoundColorWidget::importPalette() { QgsSettings s; QString lastDir = s.value( QStringLiteral( "/UI/lastGplPaletteDir" ), QDir::homePath() ).toString(); QString filePath = QFileDialog::getOpenFileName( this, tr( "Select palette file" ), lastDir, QStringLiteral( "GPL (*.gpl);;All files (*.*)" ) ); activateWindow(); if ( filePath.isEmpty() ) { return; } //check if file exists QFileInfo fileInfo( filePath ); if ( !fileInfo.exists() || !fileInfo.isReadable() ) { QMessageBox::critical( nullptr, tr( "Invalid file" ), tr( "Error, file does not exist or is not readable" ) ); return; } s.setValue( QStringLiteral( "/UI/lastGplPaletteDir" ), fileInfo.absolutePath() ); QFile file( filePath ); QgsNamedColorList importedColors; bool ok = false; QString paletteName; importedColors = QgsSymbolLayerUtils::importColorsFromGpl( file, ok, paletteName ); if ( !ok ) { QMessageBox::critical( nullptr, tr( "Invalid file" ), tr( "Palette file is not readable" ) ); return; } if ( importedColors.length() == 0 ) { //no imported colors QMessageBox::critical( nullptr, tr( "Invalid file" ), tr( "No colors found in palette file" ) ); return; } //TODO - handle conflicting file names, name for new palette QgsUserColorScheme *importedScheme = new QgsUserColorScheme( fileInfo.fileName() ); importedScheme->setName( paletteName ); importedScheme->setColors( importedColors ); QgsApplication::colorSchemeRegistry()->addColorScheme( importedScheme ); //refresh combobox refreshSchemeComboBox(); mSchemeComboBox->setCurrentIndex( mSchemeComboBox->count() - 1 ); }
ExportObjectDialog::ExportObjectDialog(QWidget &parent, CaptureFile &cf, register_eo_t* eo) : WiresharkDialog(parent, cf), eo_ui_(new Ui::ExportObjectDialog), save_bt_(NULL), save_all_bt_(NULL), model_(eo, this), proxyModel_(this) { QPushButton *close_bt; eo_ui_->setupUi(this); setAttribute(Qt::WA_DeleteOnClose, true); proxyModel_.setSourceModel(&model_); eo_ui_->objectTree->setModel(&proxyModel_); proxyModel_.setFilterFixedString(""); proxyModel_.setFilterCaseSensitivity(Qt::CaseInsensitive); proxyModel_.setFilterKeyColumn(-1); #if defined(Q_OS_MAC) eo_ui_->progressLabel->setAttribute(Qt::WA_MacSmallSize, true); eo_ui_->progressBar->setAttribute(Qt::WA_MacSmallSize, true); #endif connect(&model_, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(modelDataChanged(QModelIndex))); connect(&model_, SIGNAL(modelReset()), this, SLOT(modelRowsReset())); connect(eo_ui_->filterLine, &QLineEdit::textChanged, &proxyModel_, &QSortFilterProxyModel::setFilterFixedString); save_bt_ = eo_ui_->buttonBox->button(QDialogButtonBox::Save); save_all_bt_ = eo_ui_->buttonBox->button(QDialogButtonBox::SaveAll); close_bt = eo_ui_->buttonBox->button(QDialogButtonBox::Close); setWindowTitle(wsApp->windowTitleString(QStringList() << tr("Export") << tr("%1 object list").arg(proto_get_protocol_short_name(find_protocol_by_id(get_eo_proto_id(eo)))))); if (save_bt_) save_bt_->setEnabled(false); if (save_all_bt_) save_all_bt_->setEnabled(false); if (close_bt) close_bt->setDefault(true); connect(&cap_file_, SIGNAL(captureEvent(CaptureEvent)), this, SLOT(captureEvent(CaptureEvent))); show(); raise(); activateWindow(); }
bool MeshLabXMLStdDialog::showAutoDialog(MeshLabXMLFilterContainer& mfc,PluginManager& pm,MeshDocument * md, MainWindowInterface *mwi, QWidget *gla/*=0*/ ) { /*if (mfc.filterInterface == NULL) return false;*/ curMeshDoc = md; if (curMeshDoc == NULL) return false; env.loadMLScriptEnv(*curMeshDoc,pm); if (mfc.xmlInfo == NULL) return false; if (mfc.act == NULL) return false; validcache = false; //curAction=mfc.act; curmfc=&mfc; curmwi=mwi; curParMap.clear(); //prevParMap.clear(); curModel = md->mm(); curgla=gla; QString fname = mfc.act->text(); //mfi->initParameterSet(action, *mdp, curParSet); MLXMLPluginInfo::XMLMapList mplist = mfc.xmlInfo->filterParametersExtendedInfo(fname); curParMap = mplist; //curmask = mfc->xmlInfo->filterAttribute(mfc->act->text(),QString("postCond")); if(curParMap.isEmpty() && !isPreviewable()) return false; QTime tt; tt.start(); createFrame(); loadFrameContent(); curMeshDoc->Log.Logf(GLLogStream::SYSTEM,"GUI created in %i msec",tt.elapsed()); //QString postCond = mfc.xmlInfo->filterAttribute(fname,MLXMLElNames::filterPostCond); //QStringList postCondList = postCond.split(QRegExp("\\W+"), QString::SkipEmptyParts); //curmask = MeshLabFilterInterface::convertStringListToMeshElementEnum(postCondList); if(isPreviewable()) { meshState.create(curmask, curModel); connect(stdParFrame,SIGNAL(parameterChanged()), this, SLOT(applyDynamic())); } connect(curMeshDoc, SIGNAL(currentMeshChanged(int)),this, SLOT(changeCurrentMesh(int))); raise(); activateWindow(); return true; }
void QgsDataDefinedButton::showExpressionDialog() { QgsExpressionBuilderDialog d( const_cast<QgsVectorLayer*>( mVectorLayer ), getExpression() ); if ( d.exec() == QDialog::Accepted ) { QString newExp = d.expressionText(); setExpression( d.expressionText().trimmed() ); bool hasExp = !newExp.isEmpty(); setUseExpression( hasExp ); setActive( hasExp ); updateGui(); } activateWindow(); // reset focus to parent window }
void QgsHelpViewer::showHelp( QString help ) { // Set the browser text to the help contents QString myStyle = QgsApplication::reportStyleSheet(); QString helpContents = "<head><style>" + myStyle + "</style></head><body>" + help + "</body>"; webView->setHtml( helpContents ); setWindowTitle( tr( "QGIS Help" ) ); #ifndef WIN32 setWindowState( windowState() & ~Qt::WindowMinimized ); #endif raise(); activateWindow(); show(); }
void QbWindow::show() { if(isVisible() == false) { uint8_t *data; unsigned length; base64::decode(data, length, geometryString); QByteArray array((const char*)data, length); delete[] data; restoreGeometry(array); QWidget::show(); } QApplication::processEvents(); activateWindow(); raise(); }