Exemplo n.º 1
0
void caNumeric::setColors(QColor bg, QColor fg)
{
    if(thisColorMode == Default) {
        if(!styleSheet().isEmpty()) {
            setStyleSheet("");
            renewStyleSheet = true;
            // force resize for repainting
            QResizeEvent *re = new QResizeEvent(size(), size());
            resizeEvent(re);
            delete re;
        }
        return;
    }

    if((bg != oldBackColor) || (fg != oldForeColor)  || renewStyleSheet || styleSheet().isEmpty()) {
        renewStyleSheet = false;
        QString style = "background: rgb(%1, %2, %3, %4); color: rgb(%5, %6, %7, %8);";
        style = style.arg(bg.red()).arg(bg.green()).arg(bg.blue()).arg(bg.alpha()).
                arg(fg.red()).arg(fg.green()).arg(fg.blue()).arg(fg.alpha());
        setStyleSheet(style);
        oldForeColor = fg;
        oldBackColor = bg;
        // force resize for repainting
        QResizeEvent *re = new QResizeEvent(size(), size());
        resizeEvent(re);
        delete re;
    }
}
Exemplo n.º 2
0
static void doStyling(QApplication& app)
{
    QString ws;
#ifdef Q_WS_MAC
    ws = "macos";
#endif // Q_WS_MAC

#ifdef Q_WS_WIN
    ws = "windows";
#endif // Q_WS_WIN

#ifdef Q_WS_X11
    ws = "x11";
#endif // Q_WS_X11

    QFile platformCssFile(QString(":/bauhaus-%1.css").arg(ws));
    platformCssFile.open(QIODevice::ReadOnly | QIODevice::Text);
    QTextStream platformCssStream(&platformCssFile);
    QString styleSheet(platformCssStream.readAll());
    platformCssFile.close();

    QFile genericCssFile(QLatin1String(":/bauhaus.css"));
    genericCssFile.open(QIODevice::ReadOnly | QIODevice::Text);
    QTextStream genericCssStream(&genericCssFile);
    styleSheet.append(genericCssStream.readAll());
    genericCssFile.close();

    app.setStyleSheet(styleSheet);
}
Exemplo n.º 3
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QFile styleSheet(":/Flat.css");
    if (styleSheet.open(QIODevice::ReadOnly))
        app.setStyleSheet(styleSheet.readAll());

    UsersColorsPool colorsPool;
    QStringList botNames("ninjamers.servebeer.com");

    ChatPanel chatPanel(botNames, &colorsPool);
    chatPanel.setObjectName(QStringLiteral("ChatPanel"));

    chatPanel.addMessage("UserName", "message", true);
    chatPanel.addMessage("A_big_user_name_", "message", true);
    chatPanel.addMessage("A_big_user_name_", "A big message text to see if the layout is working ok when users decide chat using long texts :)", true);
    chatPanel.addMessage("Jamtaba", "User XXX leave the room", false);
    chatPanel.addMessage("ninjamers.servebeer.com", "Welcome!", true);

    chatPanel.show();
    chatPanel.setMinimumHeight(600);
    chatPanel.setMaximumWidth(200); //forcing the mini mode width

    return app.exec();
}
Exemplo n.º 4
0
void SettingsForm::saveSettings()
{
	m_SoundOnGameStart = ui.optionSoundGameStart->isChecked();
	settings->setValue("GameStartedSound", m_SoundOnGameStart);

	m_FriendFollow = ui.optionFriendFollow->isChecked();
	settings->setValue("FriendFollow", m_FriendFollow);

	m_Refresh = ui.optionRefresh->isChecked();
	settings->setValue("InactiveRefresh", m_Refresh);

	m_Skin = ui.cmbSkin->currentText();
	settings->setValue("Skin", m_Skin);

	QFile styleSheet(QString("./skins/%1/style.css").arg(m_Skin));
	QString style;

	if(styleSheet.open(QFile::ReadOnly))
	{
		QTextStream styleIn(&styleSheet);
		style = styleIn.readAll();
		styleSheet.close();

		QMainWindow* parent = (QMainWindow*)this->parent();
		parent->setStyleSheet(style);

		emit reloadSkin();
	}

	this->close();
}
Exemplo n.º 5
0
VVimCmdLineEdit::VVimCmdLineEdit(QWidget *p_parent)
    : VLineEdit(p_parent), m_type(VVim::CommandLineType::Invalid),
      m_registerPending(false), m_enableInputMethod(true)
{
    // When user delete all the text, cancel command input.
    connect(this, &VVimCmdLineEdit::textChanged,
            this, [this](const QString &p_text){
                if (p_text.isEmpty()) {
                    emit commandCancelled();
                } else {
                    emit commandChanged(m_type, p_text.right(p_text.size() - 1));
                }
            });

    connect(this, &VVimCmdLineEdit::textEdited,
            this, [this](const QString &p_text){
                if (p_text.size() < 2) {
                    m_userLastInput.clear();
                } else {
                    m_userLastInput = p_text.right(p_text.size() - 1);
                }
            });

    m_originStyleSheet = styleSheet();
}
Exemplo n.º 6
0
void VirtualClusterLineEdit::sHandleNullStr()
{
  if (_nullStr.isEmpty() ||
      !_parsed)
    return;

  QString sheet = styleSheet();
  QString nullStyle = " QLineEdit{ color: Grey; "
                      "            font: italic; "
                      "            font-size: 12px}";

  if (!hasFocus() &&
      text().isEmpty() &&
      !_valid)
  {
    setText(_nullStr);
    sheet.append(nullStyle);
  }
  else if (hasFocus() && !_valid)
  {
    clear();
    sheet.remove(nullStyle);
  }
  else if (_valid)
    sheet.remove(nullStyle);

  setStyleSheet(sheet);
}
Exemplo n.º 7
0
//VOXOX CHANGE by Rolando - 2009.06.16 
void QtVoxOxCallBarFrame::updateStyleSheet(QString backgroundFlagColor, 
										   QString borderFlagColor,
										   QString flagTextColor,
										   QString backgroundComboBoxColor, 
										   QString borderComboBoxColor, 
										   QString backgroundGeneralColor,
										   QString backgroundComboBoxDropDown,
										   QString primaryComboBoxTextColor,
										   QString secondaryComboBoxTextColor,
										   QString comboBoxDropDownPixmapPath,
										   QString flagDropPixmapPath){

   //VOXOX CHANGE by Rolando - 2009.06.16 
	setStyleSheet(  QString("QtVoxOxCallBarFrame{ background: %1; border-radius: 5px; } ").arg(backgroundGeneralColor)
		          + QString( "QComboBox#callBarComboBox{ border: 1px solid %1; background: %2; border-radius: 0px;} ").arg(borderComboBoxColor).arg(backgroundComboBoxColor)
				  + QString( "QFrame#flagFrame{ border: 1px solid %1; background: %2; border-radius: 2px; } ").arg(borderFlagColor).arg(backgroundFlagColor)
				  + QString( "QLabel#areaCodeLabel{ color: %1; } ").arg(flagTextColor)
				  + QString( "QComboBox::drop-down:editable { background: %1; border: none; } ").arg(backgroundComboBoxDropDown)
				  + QString( "QLabel#flagDropLabel{border: 0; image: url(%1); } ").arg(flagDropPixmapPath)
				  + QString( "VoxOxToolTipLineEdit{ margin-left: 2px; border-radius: 0px;} "));

	if(comboBoxDropDownPixmapPath != ""){
		setStyleSheet( styleSheet() + QString( "QComboBox::down-arrow { image: url(%1); } ").arg(comboBoxDropDownPixmapPath));
	}
				 
	_voxOxToolTipLineEdit->setPrimaryColorStyleSheet(QString(" QWidget{ border: none; color: %1; background: %2; border-radius: 0px; }").arg(primaryComboBoxTextColor).arg(backgroundComboBoxColor));
	_voxOxToolTipLineEdit->setSecondaryColorStyleSheet(QString(" QWidget{ border: none; color: %1; background: %2; border-radius: 0px; }").arg(secondaryComboBoxTextColor).arg(backgroundComboBoxColor));
	update();
}
Exemplo n.º 8
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
    QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
    QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
    //设置日志接口
    QFileLogger::InitLog();
    SetLogger(new QFileLogger);
    QFile styleSheet("./../qssfiles/style.qss");
    if(!styleSheet.open(QIODevice::ReadOnly))
    {
        qWarning("style sheet load fail!");
        QMessageBox::warning(NULL, QObject::tr("警告"), QObject::tr("布局文件打开失败,页面无法正常布局"));
    }
    a.setStyleSheet(styleSheet.readAll());
    setGlobalValue(Maintain::LaneIp, "192.168.26.219");
    setGlobalValue(Maintain::LanePassword, "1q2w3e");
    setGlobalValue(Maintain::LaneUser, "root");
    AutoUpdate updateSoftware;
    if(!updateSoftware.softWareUpdate())
    {
        int code=QMessageBox::warning(NULL,QObject::tr("软件更新"),QObject::tr("软件更新失败:%1")
                             .arg(updateSoftware.getErrorMessage()),QMessageBox::Ok);
        if(code==QMessageBox::Ok)
            return -1;
    }
    FormMain w;
    LogMsg("RSU",QObject::tr("12skl;ghsirhgpuisrhgiuhipaeru"));
    w.show();
    return a.exec();
}
void ribi::reversi::QtReversiMenuDialog::on_button_about_clicked() noexcept
{
  QtAboutDialog d(MenuDialog().GetAbout());
  d.setWindowIcon(windowIcon());
  d.setStyleSheet(styleSheet());
  ShowChild(&d);
}
Exemplo n.º 10
0
SketchMainHelpPrivate::SketchMainHelpPrivate (
		const QString &viewString,
		const QString &htmlText,
		SketchMainHelp *parent)
	: QFrame()
{
	setObjectName("sketchMainHelp"+viewString);
	m_parent = parent;

	QFrame *main = new QFrame(this);
	QHBoxLayout *mainLayout = new QHBoxLayout(main);

	QLabel *imageLabel = new QLabel(this);
	QLabel *imageLabelAux = new QLabel(imageLabel);
	imageLabelAux->setObjectName(QString("inviewHelpImage%1").arg(viewString));
	QPixmap pixmap(QString(":/resources/images/helpImage%1.png").arg(viewString));
	imageLabelAux->setPixmap(pixmap);
	imageLabel->setFixedWidth(pixmap.width());
	imageLabel->setFixedHeight(pixmap.height());
	imageLabelAux->setFixedWidth(pixmap.width());
	imageLabelAux->setFixedHeight(pixmap.height());

	ExpandingLabel *textLabel = new ExpandingLabel(this);
	textLabel->setLabelText(htmlText);
	textLabel->setFixedWidth(430 - 41 - pixmap.width());
	textLabel->allTextVisible();
	setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
	textLabel->setToolTip("");
	textLabel->setAlignment(Qt::AlignLeft);

	mainLayout->setSpacing(6);
	mainLayout->setMargin(2);
	mainLayout->addWidget(imageLabel);
	mainLayout->addWidget(textLabel);
	setFixedWidth(430);

	QVBoxLayout *layout = new QVBoxLayout(this);
	m_closeButton = new SketchMainHelpCloseButton(viewString,this);
	connect(m_closeButton, SIGNAL(clicked()), this, SLOT(doClose()));

	QFrame *bottomMargin = new QFrame(this);
	bottomMargin->setFixedHeight(m_closeButton->height());

	layout->addWidget(m_closeButton);
	layout->addWidget(main);
	layout->addWidget(bottomMargin);

	layout->setSpacing(0);
	layout->setMargin(2);

	m_shouldGetTransparent = false;
	//m_closeButton->doHide();

	QFile styleSheet(":/resources/styles/inviewhelp.qss");
    if (!styleSheet.open(QIODevice::ReadOnly)) {
		qWarning("Unable to open :/resources/styles/inviewhelp.qss");
	} else {
		setStyleSheet(styleSheet.readAll());
	}
}
Exemplo n.º 11
0
void DeviceWizardFinal::checkDeviceName()
{
    if (this->deviceName->text() == "") {
        this->deviceName->setToolTip(
            "Invalid Device Name. Device Name is an empty string");
        this->nameOkay = false;
        emit this->completeChanged();
        return;
    }

    this->settings.beginGroup(setcon::DEVICE_GROUP);
    QStringList devices = this->settings.childGroups();
    for (const auto &d : devices) {
        if (d == this->deviceName->text()) {
            this->nameOkay = false;
            emit this->completeChanged();
            this->deviceName->setStyleSheet("QLineEdit {color: red;}");
            this->deviceName->setToolTip(
                "Invalid Device Name. The Device Name \"" + d +
                "\" is already in use");
            this->settings.endGroup();
            return;
        }
    }
    this->settings.endGroup();
    this->deviceName->setStyleSheet(styleSheet());
    this->deviceName->setToolTip("");
    this->nameOkay = true;
    emit this->completeChanged();
}
Exemplo n.º 12
0
void XLineEdit::sHandleNullStr()
{
  if (_nullStr.isEmpty())
    return;

  QString sheet = styleSheet();
  QString nullStyle = " QLineEdit{ color: Grey; "
                      "            font: italic; "
                      "            font-size: 12px}";

  if (!hasFocus() &&
      text().isEmpty())
  {
    setText(_nullStr);
    sheet.append(nullStyle);
    _isNull = true;
  }
  else if (hasFocus() &&
           sheet.contains(nullStyle))
  {
    clear();
    sheet.remove(nullStyle);
  }
  else
  {
    _isNull = false;
    sheet.remove(nullStyle);
  }

  setStyleSheet(sheet);
}
Exemplo n.º 13
0
void MainWindow::createWidgets()
{
    startButton = new QPushButton(tr("St&art"));
    pauseOrResumeButton = new QPushButton(tr("Pa&use"));
    pauseOrResumeButton->setEnabled(false);
    stopButton = new QPushButton(tr("Stop"));
    quitButton = new QPushButton(tr("Quit"));

    QString styleSheet("background-color: bisque;");
    initialCountLabel = new QLabel(tr("Initial count:"));
    initialCountLabel->setStyleSheet(styleSheet);
    initialCountSpinBox = new QSpinBox;
    initialCountLabel->setBuddy(initialCountSpinBox);
    initialCountSpinBox->setRange(1, 100);
    initialCountSpinBox->setValue(60);
    initialCountSpinBox->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
    currentCountLabel = new QLabel(tr("Current count"));
    currentCountLabel->setStyleSheet(styleSheet);
    currentCountLCD = new QLCDNumber;
    currentCountLCD->setSegmentStyle(QLCDNumber::Flat);
    currentCountLCD->setStyleSheet(styleSheet);
    iterationsLabel = new QLabel(tr("Iterations"));
    iterationsLabel->setStyleSheet(styleSheet);
    iterationsLCD = new QLCDNumber;
    iterationsLCD->setSegmentStyle(QLCDNumber::Flat);
    iterationsLCD->setStyleSheet(styleSheet);
    showIdsCheckBox = new QCheckBox(tr("Show I&Ds"));
    showIdsCheckBox->setStyleSheet(styleSheet);
    showIdsCheckBox->setChecked(true);

    AQP::accelerateWidgets(QList<QWidget*>() << startButton
            << stopButton << quitButton << initialCountLabel
            << showIdsCheckBox);
}
Exemplo n.º 14
0
void FramelessDialog::setStyleSheetFile(const QString& fileName) {
    QFile globalStyleSheet(PathUtils::resourcesPath() + "styles/global.qss");
    QFile styleSheet(PathUtils::resourcesPath() + fileName);
    if (styleSheet.open(QIODevice::ReadOnly) && globalStyleSheet.open(QIODevice::ReadOnly) ) {
        QDir::setCurrent(PathUtils::resourcesPath());
        setStyleSheet(globalStyleSheet.readAll() + styleSheet.readAll());
    }
}
Exemplo n.º 15
0
PoolTreeView::PoolTreeView(QWidget* _parent) : WalletTreeView(_parent) {
  QString styleSheetString = styleSheet();
  styleSheetString.append(POOL_TREE_VIEW_STYLE_SHEET_TEMPLATE);

  setStyleSheet(Settings::instance().getCurrentStyle().makeStyleSheet(styleSheetString));
  setAcceptDrops(true);
  viewport()->installEventFilter(this);
}
Exemplo n.º 16
0
PriceEdit::PriceEdit(QWidget *parent) :
    MoneyEdit(parent)
{
    setReadOnly(true);
    setStyleSheet("background: rgba(255, 255, 255, 55)");
    defaultStyle = styleSheet();

}
Exemplo n.º 17
0
void PrintLayout::printTable() const
{
	QTextDocument doc;
	QSizeF pageSize;
	pageSize.setWidth(pageRect.width());
	pageSize.setHeight(pageRect.height());
	doc.setPageSize(pageSize);

	QString styleSheet(
		"<style type='text/css'>" \
		"table {" \
		"	border-width: 1px;" \
		"	border-style: solid;" \
		"	border-color: #999999;" \
		"}" \
		"th {" \
		"	background-color: #eeeeee;" \
		"	font-size: small;" \
		"	padding: 3px 5px 3px 5px;" \
		"}" \
		"td {" \
		"	font-size: small;" \
		"	padding: 3px 5px 3px 5px;" \
		"}" \
		"</style>"
	);
	// setDefaultStyleSheet() doesn't work here?
	QString htmlText = styleSheet + "<table cellspacing='0' width='100%'>";
	QString htmlTextPrev;
	int pageCountNew = 1, pageCount;
	bool insertHeading = true;

	int i;
	struct dive *dive;
	for_each_dive(i, dive) {
		if (!dive->selected && printOptions->print_selected)
			continue;
		if (insertHeading) {
			htmlText += insertTableHeadingRow();
			insertHeading = false;
		}
		htmlTextPrev = htmlText;
		htmlText += insertTableDataRow(dive);
		doc.setHtml(htmlText);
		pageCount = pageCountNew;
		pageCountNew = doc.pageCount();
		/* if the page count increases after adding this row we 'revert'
		 * and add a heading instead. */
		if (pageCountNew > pageCount) {
			htmlText = htmlTextPrev;
			insertHeading = true;
			i--;
		}
	}
	htmlText += "</table>";
	doc.setHtml(htmlText);
	doc.print(printer);
}
Exemplo n.º 18
0
void ExpandableGroupBox::setExpanded(bool e) {
  _expanded=e;
  // As told in Qt stylesheet reference, this force recomputation of stylesheet based on dynamic properties
  setStyleSheet(styleSheet());

  if (_widget) {
    _widget->setVisible(e);
  }
}
Exemplo n.º 19
0
//Loading qss and setting style from it--------------------------------
void YouCam::setStyle(QString fname)
{
    QFile styleSheet(fname); // load CSS file
    if (!styleSheet.open(QIODevice::ReadOnly)) {
        qWarning("Unable to open file");
        return;
    }
    qApp->setStyleSheet(styleSheet.readAll()); // set own style
    styleSheet.close(); //close the file
}
Exemplo n.º 20
0
// visual update for the selected button
void UIcolorEditor::changeLastButton(CaptureButton *b) {
    if (m_lastButtonPressed != b) {
        m_lastButtonPressed->setIcon(QIcon());
        m_lastButtonPressed = b;

        QString offStyle("QLabel { color : gray; }");

        if (b == m_buttonMainColor) {
            m_colorWheel->setColor(m_uiColor);
            m_labelContrast->setStyleSheet(offStyle);
            m_labelMain->setStyleSheet(styleSheet());
        } else {
            m_colorWheel->setColor(m_contrastColor);
            m_labelContrast->setStyleSheet(styleSheet());
            m_labelMain->setStyleSheet(offStyle);
        }
        b->setIcon(b->icon());
    }
}
void AbstractConnectorInfoWidget::reapplyStyle() {
	QString path = ":/resources/styles/partseditor.qss";
	QFile styleSheet(path);

	if (!styleSheet.open(QIODevice::ReadOnly)) {
		qWarning("Unable to open :/resources/styles/partseditor.qss");
	} else {
		setStyleSheet(styleSheet.readAll());
	}
}
Exemplo n.º 22
0
void MainWindow::setNomalStyle()
{
    QFile styleSheet(":/res/qss/wireless.qss");
    if (!styleSheet.open(QIODevice::ReadOnly))
    {
        qWarning("Can't open the style sheet file.");
        return;
    }
    qApp->setStyleSheet(styleSheet.readAll());
}
Exemplo n.º 23
0
Principal::Principal(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::Principal)
{
    ui->setupUi(this);
    r = -1;
    QPixmap pixmap1("icon/add.png");
    QPixmap pixmap2("icon/conf.png");
    QPixmap pixmap3("icon/del.png");
    QPixmap pixmap4("icon/Sair.png");
    QPixmap pixmap5("icon/pasta.png");
    QPixmap pixmap6("icon/detalhe.png");
    QIcon ButtonIcon(pixmap1);
    QIcon ButtonIcon1(pixmap2);
    QIcon ButtonIcon2(pixmap3);
    QIcon ButtonIcon3(pixmap4);
    QIcon ButtonIcon4(pixmap5);
    QIcon ButtonIcon5(pixmap6);
    ui->add_3->setIcon(ButtonIcon);
    ui->add_3->setIconSize(pixmap1.rect().size());
    ui->add_3->setStyleSheet(styleSheet().append(QString("border-image:url(icon/1.png);")));
    ui->alterar->setIcon(ButtonIcon1);
    ui->alterar->setIconSize(pixmap1.rect().size());
    ui->alterar->setStyleSheet(styleSheet().append(QString("border-image:url(icon/1.png);")));
    ui->deletar->setIcon(ButtonIcon2);
    ui->deletar->setIconSize(pixmap1.rect().size());
    ui->deletar->setStyleSheet(styleSheet().append(QString("border-image:url(icon/1.png);")));
    ui->sair->setIcon(ButtonIcon3);
    ui->sair->setIconSize(pixmap1.rect().size());
    ui->sair->setStyleSheet(styleSheet().append(QString("border-image:url(icon/1.png);")));
    ui->pasta->setIcon(ButtonIcon4);
    ui->pasta->setIconSize(pixmap1.rect().size());
    ui->pasta->setStyleSheet(styleSheet().append(QString("border-image:url(icon/1.png);")));
    AnimeDao a;
    if(a.getStatus() == true){
        ui->statusBar->showMessage("Quantidade de Animes Cadastrados: "+QString::number(a.getLista().length()));
    }
    preencheTabela(a.getLista());
    QPixmap pixmap9("icon/icon.png");
    this->setWindowIcon(pixmap9);

}
Exemplo n.º 24
0
void StyleWidget::on_transparentStyle_clicked()
{
    QFile styleSheet(":/files/transparent.qss");

    if (!styleSheet.open(QIODevice::ReadOnly)) {
        qWarning("Unable to open :/files/transparent.qss");
        return;
    }

    qApp->setStyleSheet(styleSheet.readAll());
}
Exemplo n.º 25
0
void CodeViewWidget::OnSelectionChanged()
{
  if (m_address == PowerPC::ppcState.pc)
  {
    setStyleSheet(
        QStringLiteral("QTableView::item:selected {background-color: #00FF00; color: #000000;}"));
  }
  else if (!styleSheet().isEmpty())
  {
    setStyleSheet(QStringLiteral(""));
  }
}
Exemplo n.º 26
0
CSVSettings::Frame::Frame (bool isVisible, const QString &title,
                                                               QWidget *parent)
    : mIsHorizontal (true), mLayout (new SettingLayout()),
    QGroupBox (title, parent)
{
    setFlat (true);
    mVisibleBoxStyle = styleSheet();

    if (!isVisible)
        setStyleSheet (sInvisibleBoxStyle);

    setLayout (mLayout);
}
Exemplo n.º 27
0
ConsoleWindow::ConsoleWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::ConsoleWindow)
{
    QFile styleSheet(":/resources/styles/programwindow.qss");

    this->setObjectName("consoleWindow");
    if (!styleSheet.open(QIODevice::ReadOnly)) {
        qWarning("Unable to open :/resources/styles/programwindow.qss");
    } else {
        QString ss = styleSheet.readAll();
#ifdef Q_OS_MAC
                int paneLoc = 4;
                int tabBarLoc = 0;
#else
                int paneLoc = -1;
                int tabBarLoc = 5;
#endif
                ss = ss.arg(paneLoc).arg(tabBarLoc);
        this->setStyleSheet(ss);
    }

    ui->setupUi(this);
    console = new Console;
    console->setEnabled(false);
    setCentralWidget(console);
    serial = new QSerialPort(this);
    settings = new ConsoleSettings;

    QSettings settings;
    if (!settings.value("consolewindow/state").isNull()) {
        restoreState(settings.value("consolewindow/state").toByteArray());
    }
    if (!settings.value("consolewindow/geometry").isNull()) {
        restoreGeometry(settings.value("consolewindow/geometry").toByteArray());
    }

    ui->actionConnect->setEnabled(true);
    ui->actionDisconnect->setEnabled(false);
    ui->actionQuit->setEnabled(true);
    ui->actionConfigure->setEnabled(true);

    initActionsConnections();

    connect(serial, SIGNAL(error(QSerialPort::SerialPortError)), this,
            SLOT(handleError(QSerialPort::SerialPortError)));

    connect(serial, SIGNAL(readyRead()), this, SLOT(readData()));
    connect(console, SIGNAL(getData(QByteArray)), this, SLOT(writeData(QByteArray)));
}
Exemplo n.º 28
0
QuoteDialog::QuoteDialog(bool full, QWidget *parent) : QDialog(parent) 
{
    initCounts();
    QFile styleSheet(":/resources/styles/fritzing.qss");
    if (!styleSheet.open(QIODevice::ReadOnly)) {
        DebugDialog::debug("Unable to open :/resources/styles/fritzing.qss");
    } else {
    	this->setStyleSheet(styleSheet.readAll());
    }

	setWindowTitle(tr("Fritzing Fab Quote"));

	QVBoxLayout * vLayout = new QVBoxLayout(this);

    QLabel * label = new QLabel(tr("Order your PCB from Fritzing Fab"));
    label->setObjectName("quoteOrder");
    vLayout->addWidget(label);

	m_messageLabel = new QLabel(tr(""));
    m_messageLabel->setObjectName("quoteMessage");
	vLayout->addWidget(m_messageLabel);

    m_tableWidget = new QTableWidget(3, MessageCount + 1);
    m_tableWidget->setObjectName("quoteTable");
    m_tableWidget->setShowGrid(false);

    m_tableWidget->verticalHeader()->setVisible(false);
    m_tableWidget->horizontalHeader()->setVisible(false);
    
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    m_tableWidget->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
    m_tableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
#else
    m_tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    m_tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
#endif
    
    m_tableWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_tableWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    m_tableWidget->setItemDelegate(new CustomDelegate(m_tableWidget));
    QStringList labels;
    labels << tr("Copies") << tr("Price per board") << tr("Price");
    int ix = 0;
    foreach (QString labl, labels) {
        QTableWidgetItem * item = new QTableWidgetItem(labl);
        item->setFlags(0);
        m_tableWidget->setItem(ix, 0, item);
        ix += 1;
    }
Exemplo n.º 29
0
void KLFDisplayLabel::set_error(bool error_on)
{
  KLF_DEBUG_BLOCK(KLF_FUNC_NAME) ;
  setProperty("realTimeLatexError", QVariant(error_on));
  QPalette *p;
  if (error_on) {
    p = &pErrorPalette;
  } else {
    p = &pDefaultPalette;
  }
  setAutoFillBackground(true);
  setStyleSheet(styleSheet()); // force style sheet refresh
  setPalette(*p);
}
Exemplo n.º 30
0
void SelectableEntry::reverseColors() {
	bool focused = m_ui->topLine->isVisible();
	setFocusLook(false);
	QString originalStyle = styleSheet();
	setStyleSheet(originalStyle+"; color: white; background-color: black");
	setAutoFillBackground(true);
	/* Force a repaint */
	repaint();
	/* Reset things for the next time */
	setStyleSheet(originalStyle);
	if(focused) {
		setFocusLook(true);
	}

}