GridButton::GridButton(const int i , const int j , QWidget *parent) :QPushButton(parent) { setAccessibleName(QString("GridButton")); row = i; col = j; XIcon = QIcon(":/new/prefix1/images/x3.png"); color = QColor(Qt::white); borderTop = QColor(); borderRight = QColor(); borderBottom = QColor(); borderLeft = QColor(); borderTop.setNamedColor("#A0A0A0"); borderRight.setNamedColor("#A0A0A0"); borderBottom.setNamedColor("#A0A0A0"); borderLeft.setNamedColor("#A0A0A0"); this->setFixedSize(20,20); //Load the stylesheet file for widgets QFile stylesFile(":/new/prefix1/qss/styles.qss"); if(stylesFile.open(QIODevice::ReadOnly | QIODevice::Text)) { qss = stylesFile.readAll(); stylesFile.close(); } initBorders(); updateStyle(); }
void MainWindow::saveConfig() { QFile configFile(this->userFolder + CONFIG_FILE); if (configFile.open(QIODevice::WriteOnly)) { QString data("# Maurina config file.\n" "# Default values:\n# serverIp = 127.0.0.1\n" "# serverPort = 1947\n# timeoutEnabled = 1\n" "# timeoutValue = 2\n# windowX = 50\n" "# windowY = 50\n# windowW = 700\n# windowH = 400\n" "# tab1caption = Log 1\n# tab2caption = Log 2\n" "# tab3caption = Log 3\n# tab4caption = Log 4\n" "# tab5caption = Log 5\n# controlsVisible = 1\n" "# layout = 0\n\n"); data += "serverIp = " + this->serverIp.toString() + "\n"; data += "serverPort = " + QString::number(this->serverPort)+"\n"; data += "timeoutEnabled = "; data += (this->timeoutEnabled) ? "1" : "0"; data += "\ntimeoutValue = " + QString::number(this->timeoutValue)+"\n"; QRect wGeometry = this->geometry(); data += "windowX = " + QString::number(wGeometry.x())+"\n"; data += "windowY = " + QString::number(wGeometry.y())+"\n"; data += "windowW = " + QString::number(wGeometry.width())+"\n"; data += "windowH = " + QString::number(wGeometry.height())+"\n"; short numCaptions = this->tabCaptions.count(); for (short x = 0; x < numCaptions; ++x) { data += "tab" + QString::number(x + 1) + "caption = " + this->tabCaptions.at(x)+"\n"; } data += "controlsVisible = "; data += (this->controlsVisible) ? "1" : "0"; data += "\nlayout = "; data += QString::number(this->layoutType); QTextStream out(&configFile); out << data; configFile.close(); data += "\n# Message styles. Additional styles may be added in"; data += "\n# styles file.\n"; } QFile stylesFile(this->userFolder + STYLES_FILE); if (stylesFile.open(QIODevice::WriteOnly)) { QString data("# Maurina styles definition. You can add styles for " "any other HTML tag."); foreach(QString key, this->styles.keys()) data += "\n" + key + " = " + this->styles[key]; QTextStream out(&stylesFile); out << data; stylesFile.close(); } }