void RazorTaskBar::settigsChanged() { buttonMaxWidth = settings().value("maxWidth", 400).toInt(); QString s = settings().value("buttonStyle").toString().toUpper(); if (s == "ICON") { setButtonStyle(Qt::ToolButtonIconOnly); buttonMaxWidth = -1; setButtonMaxWidth(buttonMaxWidth); } else if (s == "TEXT") { setButtonStyle(Qt::ToolButtonTextOnly); setButtonMaxWidth(buttonMaxWidth); } else { setButtonStyle(Qt::ToolButtonTextBesideIcon); setButtonMaxWidth(buttonMaxWidth); } mShowOnlyCurrentDesktopTasks = settings().value("showOnlyCurrentDesktopTasks", mShowOnlyCurrentDesktopTasks).toBool(); RazorTaskButton::setShowOnlyCurrentDesktopTasks(mShowOnlyCurrentDesktopTasks); refreshTaskList(); }
BehaviorNotification::BehaviorNotification(QWidget *parent, QString action_text, int goal_id, int goal_type): //QWidget(parent), ui(new Ui::BehaviorNotification) { ui->setupUi(this); this->hide(); object_sub_ = nh_.subscribe("/flor/ocs/object_selection", 5 , &BehaviorNotification::objectSelectCB, this); connect(ui->confirm_button_,SIGNAL(clicked()), this, SLOT(confirm())); connect(ui->abort_button_,SIGNAL(clicked()), this, SLOT(abort())); confirmed_ = false; ui->label_widget_->setMouseTracking(true); ui->label_widget_->installEventFilter(this); ui->confirmation_widget_->setParent(NULL); ui->confirmation_widget_->show(); ui->confirmation_widget_->setVisible(false); ui->confirmation_widget_->setStyleSheet("QWidget{background-color:rgba(60,60,60,200);}"); ui->confirmation_widget_->setMinimumHeight(25); ui->confirmation_widget_->setMaximumHeight(25); ui->label_widget_->setStyleSheet("QWidget{background-color:rgba(60,60,60,200);}" "QWidget:hover{background-color:rgba(30,30,30,200);}"); setButtonStyle(ui->confirm_button_); setButtonStyle(ui->abort_button_); //want frameless widget Qt::WindowFlags flags = ui->confirmation_widget_->windowFlags(); flags |= Qt::FramelessWindowHint; flags |= Qt::WindowStaysOnTopHint; //flags |= Qt::Dialog; ui->confirmation_widget_->setWindowFlags(flags); timer.start(100, this); //dummy init main_view_point_ = this->mapToGlobal(this->geometry().topLeft()); goal_id_ = goal_id; goal_type_ = goal_type; ui->action_label_->setText(action_text); //prevent sending bad data on start //only protecting selected object types for now if(goal_type_ == flexbe_msgs::BehaviorInputGoal::SELECTED_OBJECT_ID) ui->confirm_button_->setDisabled(true); }
MenuButtonWidget::MenuButtonWidget(const ToolBarsManager::ToolBarDefinition::Entry &definition, QWidget *parent) : ToolButtonWidget(definition, parent), m_menu(new Menu(Menu::NoMenuRole, this)), m_isHidden(false) { setIcon(ThemesManager::createIcon(QLatin1String("otter-browser"), false)); setText(definition.options.value(QLatin1String("text"), tr("Menu")).toString()); setMenu(m_menu); setPopupMode(QToolButton::InstantPopup); setButtonStyle(Qt::ToolButtonTextBesideIcon); handleActionsStateChanged({ActionsManager::ShowToolBarAction}); const MainWindow *mainWindow(MainWindow::findMainWindow(this)); const ToolBarWidget *toolBar(qobject_cast<ToolBarWidget*>(parent)); if (mainWindow) { connect(mainWindow, &MainWindow::arbitraryActionsStateChanged, this, &MenuButtonWidget::handleActionsStateChanged); } if (toolBar) { disconnect(toolBar, &ToolBarWidget::buttonStyleChanged, this, &MenuButtonWidget::setButtonStyle); } connect(m_menu, &Menu::aboutToShow, this, &MenuButtonWidget::updateMenu); }
CoderPushButton::CoderPushButton(const QString & text, const QRect & rect, DeskCallQT * parent):QPushButton(text, parent) { this->parent = parent; setButtonStyle(); this->setGeometry(rect); this->show(); }
FinalMessagePage::FinalMessagePage() : mKey( "" ), mSubMessage( NULL ), mQuitButton( mainFont, 0, -300, translate( "quit" ) ) { setButtonStyle( &mQuitButton ); addComponent( &mQuitButton ); mQuitButton.addActionListener( this ); }
void KviMainWindow::buttonStylePopupSelected(QAction * pAction) { if(!pAction) return; bool bOk = false; uint uStyle = pAction->data().toUInt(&bOk); if(!bOk) return; setButtonStyle(uStyle); }
void RazorTaskBar::settingsChanged() { mButtonWidth = mPlugin->settings()->value("buttonWidth", 400).toInt(); QString s = mPlugin->settings()->value("buttonStyle").toString().toUpper(); if (s == "ICON") { setButtonStyle(Qt::ToolButtonIconOnly); } else if (s == "TEXT") { setButtonStyle(Qt::ToolButtonTextOnly); } else { setButtonStyle(Qt::ToolButtonTextBesideIcon); } mShowOnlyCurrentDesktopTasks = mPlugin->settings()->value("showOnlyCurrentDesktopTasks", mShowOnlyCurrentDesktopTasks).toBool(); RazorTaskButton::setShowOnlyCurrentDesktopTasks(mShowOnlyCurrentDesktopTasks); RazorTaskButton::setCloseOnMiddleClick(mPlugin->settings()->value("closeOnMiddleClick", true).toBool()); refreshTaskList(); }
KviMainWindow::KviMainWindow(QWidget * pParent) : KviTalMainWindow(pParent, "kvirc_frame") { g_pMainWindow = this; setAttribute(Qt::WA_DeleteOnClose); setAutoFillBackground(false); setAttribute(Qt::WA_TranslucentBackground); //disable this flag that gets enabled by qt when using Qt::WA_TranslucentBackground setAttribute(Qt::WA_NoSystemBackground, false); #if !(defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) || defined(COMPILE_KDE_SUPPORT)) // Under windows, the icon is builtin; under kde, KApplication sets it for us // We try to avois this as much as possible, since it forces the use of the low-res 16x16 icon setWindowIcon(*(g_pIconManager->getSmallIcon(KviIconManager::KVIrc))); #endif m_pWinList = new KviPointerList<KviWindow>; setWindowTitle(KVI_DEFAULT_FRAME_CAPTION); m_pWinList->setAutoDelete(false); m_pModuleExtensionToolBarList = new KviPointerList<KviMexToolBar>; m_pModuleExtensionToolBarList->setAutoDelete(false); m_pActiveContext = nullptr; m_pTrayIcon = nullptr; m_pSplitter = new QSplitter(Qt::Horizontal, this); m_pSplitter->setObjectName("main_frame_splitter"); m_pSplitter->setChildrenCollapsible(false); setCentralWidget(m_pSplitter); setIconSize(KVI_OPTION_UINT(KviOption_uintToolBarIconSize)); setButtonStyle(KVI_OPTION_UINT(KviOption_uintToolBarButtonStyle)); m_pWindowStack = new KviWindowStack(m_pSplitter, "mdi_manager"); // This theoretically had to exists before KviWindowStack (that uses enterSdiMode) m_pAccellerators = new KviPointerList<QShortcut>; m_pMenuBar = new KviMenuBar(this, "main_menu_bar"); setMenuWidget(m_pMenuBar); #ifndef COMPILE_ON_MAC m_pMenuBar->setVisible(KVI_OPTION_BOOL(KviOption_boolMenuBarVisible)); #endif if(KVI_OPTION_BOOL(KviOption_boolStatusBarVisible)) { m_pStatusBar = new KviStatusBar(this); setStatusBar(m_pStatusBar); // torque: moved out of status bar constructor // because module init functions executed in load() // couldn't access the status bar via g_pMainWindow->mainStatusBar() // (assignment of m_pStatusBar happened after load() and // the init function) m_pStatusBar->load(); } else { m_pStatusBar = nullptr; } m_pWindowList = nullptr; createWindowList(); if((KVI_OPTION_RECT(KviOption_rectFrameGeometry).width() < 100) || (KVI_OPTION_RECT(KviOption_rectFrameGeometry).height() < 100) || (KVI_OPTION_RECT(KviOption_rectFrameGeometry).x() > g_pApp->desktop()->width()) || (KVI_OPTION_RECT(KviOption_rectFrameGeometry).y() > g_pApp->desktop()->height())) { // Try to find some reasonable defaults // prefer primary screen for first startup int primary_screen = g_pApp->desktop()->primaryScreen(); QRect r = g_pApp->desktop()->screenGeometry(primary_screen); r.setLeft(r.left() + 10); r.setRight(r.right() - 100); r.setTop(r.top() + 10); r.setBottom(r.bottom() - 200); KVI_OPTION_RECT(KviOption_rectFrameGeometry) = r; } resize(KVI_OPTION_RECT(KviOption_rectFrameGeometry).width(), KVI_OPTION_RECT(KviOption_rectFrameGeometry).height()); move(KVI_OPTION_RECT(KviOption_rectFrameGeometry).x(), KVI_OPTION_RECT(KviOption_rectFrameGeometry).y()); if(KVI_OPTION_BOOL(KviOption_boolFrameIsMaximized)) showMaximized(); applyOptions(); installAccelerators(); }
TakePicView::TakePicView(int calibType, int numPictures, QWidget *parent) : QDialog(parent) { if (calibType == Enums::controllerEnum::INTRINSIC) { // create intrinsic calib stuff videoLabel = new QLabel(this); videoLabel->setMinimumWidth(640); videoLabel->setMinimumHeight(480); titleLabel = new QLabel("Intrinsic Calibration"); picProgressLabel = new QLabel(""); this->incrementSuccesses(1, numPictures); messageLabel = new QLabel("Messages: "); messages = new QLabel(""); messages->setStyleSheet("color: red; font-weight: bold;"); takePicButton = new QPushButton("Take Picture"); takePicButton->setEnabled(false); setButtonStyle(takePicButton, false); cancelButton = new QPushButton("Cancel"); setButtonStyle(cancelButton, true); connect(takePicButton, SIGNAL(clicked()), this, SLOT(takePicture())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(stopVideo())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); // layout code mainLayout = new QBoxLayout(QBoxLayout::TopToBottom); mainLayout->addWidget(titleLabel); mainLayout->addWidget(videoLabel); mainLayout->addWidget(picProgressLabel); mainLayout->addWidget(messageLabel); mainLayout->addWidget(messages); buttonLayout = new QGridLayout(); buttonLayout->addWidget(takePicButton, 0, 0); buttonLayout->addWidget(cancelButton, 1, 0); mainLayout->addLayout(buttonLayout); setLayout(mainLayout); } else if (calibType == Enums::controllerEnum::EXTRINSIC) { // create extrin calib stuff videoLabel = new QLabel(this); videoLabel->setMinimumWidth(640); videoLabel->setMinimumHeight(480); titleLabel = new QLabel("Extrinsic Calibration"); picProgressLabel = new QLabel(""); this->incrementSuccesses(1, numPictures); messageLabel = new QLabel("Messages: "); messages = new QLabel("<b>Messages Go Here</b>"); messages->setStyleSheet("color: red; font-weight: bold;"); takePicButton = new QPushButton("Take Picture"); takePicButton->setEnabled(false); setButtonStyle(takePicButton, false); cancelButton = new QPushButton("Cancel"); setButtonStyle(cancelButton, true); connect(takePicButton, SIGNAL(clicked()), this, SLOT(takePicture())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(stopVideo())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); // layout code mainLayout = new QBoxLayout(QBoxLayout::TopToBottom); mainLayout->addWidget(titleLabel); mainLayout->addWidget(videoLabel); mainLayout->addWidget(picProgressLabel); mainLayout->addWidget(messageLabel); mainLayout->addWidget(messages); buttonLayout = new QGridLayout(); buttonLayout->addWidget(takePicButton, 0, 0); buttonLayout->addWidget(cancelButton, 1, 0); mainLayout->addLayout(buttonLayout); setLayout(mainLayout); } capture.open(0); if (capture.isOpened()) { //Disable autofocus by setting focus to current focus only //capture.set(CV_CAP_PROP_FOCUS, capture.get(CV_CAP_PROP_FOCUS)); // if the Video Capture Stream is open, set button and create timer takePicButton->setEnabled(true); setButtonStyle(takePicButton, true); timer = new QTimer(this); // slot for displaying video every 20ms connect(timer, SIGNAL(timeout()), this, SLOT(displayVideoFrame())); timer->start(20); } else { videoLabel->setPixmap(QPixmap("noCamera.png")); takePicButton->setEnabled(false); setButtonStyle(takePicButton, false); messages->setStyleSheet("color: red; font-weight: bold;"); messages->setText("No camera is detected! Please check your connection!"); } }