Exemplo n.º 1
0
void MainWindow::toggledFullScreen(bool val) {
	QMenuBar* pMenuBar = menuBar();
	if ( pMenuBar )
		pMenuBar->setVisible(!val);

	QStatusBar *pStatusBar = statusBar();
	if ( pStatusBar )
		pStatusBar->setVisible(!val);
}
Exemplo n.º 2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    pSettings_(NULL),
    redValue_(0),
    greenValue_(0),
    blueValue_(0),
    pRedLabel_(NULL),
    pGreenLabel_(NULL),
    pBlueLabel_(NULL),
    pRedValueLabel_(NULL),
    pGreenValueLabel_(NULL),
    pBlueValueLabel_(NULL),
    pRedSlider_(NULL),
    pGreenSlider_(NULL),
    pBlueSlider_(NULL)
{
    ui->setupUi(this);

    QString settingsFilePath = QDir::homePath() + "/.colorsrc";
    pSettings_ = new QSettings(settingsFilePath, QSettings::NativeFormat, this);

    redValue_ = static_cast<uint8_t>(pSettings_->value(redValueKey).toInt());
    greenValue_ = static_cast<uint8_t>(pSettings_->value(greenValueKey).toInt());
    blueValue_ = static_cast<uint8_t>(pSettings_->value(blueValueKey).toInt());

    // hides all main window normal GUI related stuff
    QObjectList childObjects = children();
    foreach (QObject* pChildObject, childObjects) {
        QToolBar* pToolBar = qobject_cast<QToolBar*>(pChildObject);
        if (pToolBar)
            pToolBar->setVisible(false);

        QStatusBar* pStatusBar = qobject_cast<QStatusBar*>(pChildObject);
        if (pStatusBar)
            pStatusBar->setVisible(false);

        QMenuBar* pMenuBar = qobject_cast<QMenuBar*>(pChildObject);
        if (pMenuBar)
            pMenuBar->setVisible(false);
    }
Exemplo n.º 3
0
void Toerstein::createMenuBar(void)
{
    QMenuBar *menuBar = new QMenuBar(this);
    menuBar->setVisible(false);

    /* Create File menu */
    QMenu *fileMenu = menuBar->addMenu(tr("&File"));

    fileMenu->addAction( tr("New &Tab"), this, SLOT(createNewTab()) );
    fileMenu->addAction( tr("&New"), this, SLOT(createNewFile()) );
    fileMenu->addAction( tr("&Open"), this, SLOT(open()) );
    fileMenu->addAction( tr("Enter File &Path"), this, SLOT(search()) );
    fileMenu->addAction( tr("&Save"), this, SLOT(save()) );
    fileMenu->addAction( tr("Save As..."), this, SLOT(saveAs()) );
    fileMenu->addAction( tr("&Close File"), this, SLOT(closeFile()) );
    fileMenu->addAction( tr("&Quit"), this, SLOT(close()) );

    QMenu *viewMenu = menuBar->addMenu(tr("&View"));
    viewMenu->addAction( tr("Toggle &Diff View"), this, SLOT(toggleViewMode()) );

    this->setMenuBar(menuBar);
}
void NewGeneMainWindow::ShowHideTabs(int const checkState)
{
	// From http://stackoverflow.com/a/31147349/368896 - there is no way to add/remove individual styles from a stylesheet,
	// so we just build out the whole thing
	// No availability of raw string literals in VS2013
	QString tabStylesheetMain =
		"#tabWidgetMain pane {border-top: 2px solid #C2C7CB; position: absolute; top: -0.5em;} #tabWidgetMain QTabBar::tab {background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3); border: 2px solid #C4C4C3; border-bottom-color: #C2C7CB; border-top-left-radius: 4px; border-top-right-radius: 4px; min-width: 8ex; padding: 2px;} #tabWidgetMain QTabBar::tab:selected, QTabBar::tab:hover { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #fafafa, stop: 0.4 #f4f4f4, stop: 0.5 #e7e7e7, stop: 1.0 #fafafa); } #tabWidgetMain QTabBar::tab:selected { border-color: #9B9B9B; border-bottom-color: #C2C7CB; /* same as pane color */ } #tabWidgetMain > QTabBar { margin: 20px; } ";
	QString tabStylesheetSub;
	QString overallStylesheet;
	QString kadBoxStylesheet;
	QString kadBoxInnerStylesheet;
	QString checkboxSimpleModeStylesheet;

	NewGeneTabWidget * highLevelTabWindow { findChild<NewGeneTabWidget *>("tabWidgetMain") };
	NewGeneTabWidget * tabOutput { findChild<NewGeneTabWidget *>("tabWidgetOutput") };
	QMenu * menuInput { findChild<QMenu *>("menuInput") };
	QMenu * menuOutput { findChild<QMenu *>("menuOutput") };
	QMenu * menuAbout { findChild<QMenu *>("menuAbout") };
	QMenuBar * menuBar { findChild<QMenuBar *>("menuBar") };
	NewGeneCreateOutput * CreateOutputPane { findChild<NewGeneCreateOutput *>("CreateOutputPane") };

	// The following nesting is NOT NECESSARY to obtain pointers to the widgets.
	// I did it to debug failure which turned out to be just using the class name as the ID in the 'findChild' function.
	// But I left the code in place for convenience in case I want to access the intermediate levels in the future.

	if (highLevelTabWindow && tabOutput && menuInput && menuOutput && menuAbout && menuBar && CreateOutputPane)
	{
		NewGeneSelectVariables * widgetSelectVariablesPane { CreateOutputPane->findChild<NewGeneSelectVariables *>("widgetSelectVariablesPane") };

		if (widgetSelectVariablesPane)
		{
			KAdColumnSelectionBox * kadBox { widgetSelectVariablesPane->findChild<KAdColumnSelectionBox *>("frameKAdSelectionArea") };

			if (kadBox)
			{
				QCheckBox * checkBoxSimpleMode { kadBox->findChild<QCheckBox *>("checkBoxSimpleMode") };

				if (checkBoxSimpleMode /* && kadBoxInner */)
				{
					if (checkState == Qt::Checked)
					{
						highLevelTabWindow->setCurrentIndex(0);
						tabOutput->setCurrentIndex(0);
						tabOutput->setTabText(1, "");

						overallStylesheet += "QTabBar {background-color: #FFFFE0;}";
						setStyleSheet(overallStylesheet);

						tabStylesheetMain +=
							"#tabWidgetMain > pane { border: 0px; padding: 0px; height: 0px; } #tabWidgetMain > QTabBar::tab {margin: 0px; border: 0px; padding: 0px; height: 0px; } #tabWidgetMain > QTabBar::tab:selected, #tabWidgetMain > QTabBar::tab:hover { margin: 0px; border: 0px; padding: 0px; height: 0px; } #tabWidgetMain > QTabBar::tab:selected { margin: 0px; border: 0px; padding: 0px; height: 0px; } #tabWidgetMain > QTabBar { margin: 0px; border: 0px; padding: 0px; height: 0px; }";
						tabStylesheetSub += "QTabBar::tab:middle {width: 0px; min-width: 0px; max-width: 0px; border: 0px; padding: 0px; margin: 0px;}";
						highLevelTabWindow->setStyleSheet(tabStylesheetMain);
						tabOutput->setStyleSheet(tabStylesheetSub);

						kadBoxStylesheet += "QFrame#frameKAdSelectionArea {background-color: #DDEEDD;}";
						kadBox->setStyleSheet(kadBoxStylesheet);

						checkboxSimpleModeStylesheet += "QCheckBox#checkBoxSimpleMode {font: bold 11px; color: blue;}";
						checkBoxSimpleMode->setStyleSheet(checkboxSimpleModeStylesheet);

						menuInput->menuAction()->setVisible(false);
						menuOutput->menuAction()->setVisible(false);
						menuAbout->menuAction()->setVisible(false);
						menuBar->setVisible(false);
					}
					else
					{
						highLevelTabWindow->setStyleSheet(tabStylesheetMain);
						tabOutput->setStyleSheet(tabStylesheetSub);
						tabOutput->setTabText(1, " Limit DMUs ");
						setStyleSheet(overallStylesheet);
						kadBox->setStyleSheet(kadBoxStylesheet);
						checkBoxSimpleMode->setStyleSheet(checkboxSimpleModeStylesheet);
						menuBar->setVisible(true);
						menuAbout->menuAction()->setVisible(true);
						menuOutput->menuAction()->setVisible(true);
						menuInput->menuAction()->setVisible(true);
					}
				}
			}
		}
	}

	NewGeneVariablesToolboxWrapper * vgToolboxPane { CreateOutputPane->findChild<NewGeneVariablesToolboxWrapper *>("toolbox") };
	if (vgToolboxPane && vgToolboxPane->newgeneToolBox)
	{
		vgToolboxPane->newgeneToolBox->resetAllBarColors();
	}
}