void SkinWidget::initTitle() { title_label = new QLabel(); title_icon_label = new QLabel(); close_button = new QPushButton(); QPixmap title_pixmap(":/img/safe"); title_icon_label->setPixmap(title_pixmap); title_icon_label->setFixedSize(16, 16); title_icon_label->setScaledContents(true); //close_button->setPicName(":/sysButton/close"); title_label->setFixedHeight(30); title_layout = new QHBoxLayout(); title_layout->addWidget(title_icon_label, 0, Qt::AlignVCenter); title_layout->addWidget(title_label, 0, Qt::AlignVCenter); title_layout->addStretch(); title_layout->addWidget(close_button, 0, Qt::AlignTop); title_layout->setSpacing(5); title_layout->setContentsMargins(10, 0, 5, 0); title_label->setObjectName("whiteLabel"); connect(close_button, SIGNAL(clicked()), this, SLOT(hide())); }
void setKingdom(const QString &kingdom){ QPixmap title_pixmap(QString("diy/%1-skill.png").arg(kingdom)); setPixmap(title_pixmap); if(kingdom == "god") title_text->setDefaultTextColor(QColor(255, 255, 102)); else title_text->setDefaultTextColor(Qt::black); }
void AboutUsDialog::init() { title_label = new QLabel(); title_icon_label = new QLabel(); title_info_label = new QLabel(); info_label = new QLabel(); version_label = new QLabel(); mummy_label = new QLabel(); copyright_label = new QLabel(); icon_label = new QLabel(); close_button = new PushButton(); ok_button = new QPushButton(); QPixmap title_pixmap(":/img/safe"); title_icon_label->setPixmap(title_pixmap); title_icon_label->setFixedSize(16, 16); title_icon_label->setScaledContents(true); close_button->setPicName(QString(":/sysButton/close")); title_label->setFixedHeight(30); ok_button->setFixedSize(75, 25); QPixmap pixmap(":/img/360safe"); icon_label->setPixmap(pixmap); icon_label->setFixedSize(pixmap.size()); title_label->setObjectName("whiteLabel"); copyright_label->setObjectName("grayLabel"); title_info_label->setObjectName("infoLabel"); info_label->setObjectName("infoLabel"); ok_button->setObjectName("okButton"); QFont title_info_font("΢ÈíÑźÚ", 14, QFont::Bold, false); title_info_label->setFont(title_info_font); QFont info_font = info_label->font(); info_font.setBold(true); info_label->setFont(info_font); }
void SkinsWidget::initTitleBar() { title_label = new QLabel(); title_icon_label = new QLabel(); close_button = new QLabel(); QPixmap title_pixmap(":/pixmap/image/pc-manager.png"); title_icon_label->setPixmap(title_pixmap); title_icon_label->setFixedSize(16, 16); title_icon_label->setScaledContents(true); title_label->setFixedHeight(30); title_label->setText(tr("Pc Skin Center"));//皮肤中心 close_button->setPixmap(QPixmap(":/pixmap/image/closeBtn.png")); titleLayout = new QHBoxLayout(); titleLayout->addWidget(close_button, 0, Qt::AlignVCenter); titleLayout->addStretch(); titleLayout->addWidget(title_icon_label, 0, Qt::AlignVCenter); titleLayout->addWidget(title_label, 0, Qt::AlignVCenter); titleLayout->setSpacing(5); titleLayout->setContentsMargins(10, 0, 5, 0); title_label->setStyleSheet("color:white;"); close_button->installEventFilter(this); }
void setKingdom(const QString &kingdom){ QPixmap title_pixmap(QString("diy/%1-skill.png").arg(kingdom)); setPixmap(title_pixmap); title_text->setDefaultTextColor(Qt::black); }
AboutUsDialog::AboutUsDialog(QWidget *parent) :QDialog(parent) { this->resize(520, 290); //初始化为未按下鼠标左键 mouse_press = false; //设置标题栏隐藏 this->setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog); title_label = new QLabel(); title_icon_label = new QLabel(); title_info_label = new QLabel(); info_label = new QLabel(); version_label = new QLabel(); mummy_label = new QLabel(); copyright_label = new QLabel(); icon_label = new QLabel(); close_button = new PushButton(); ok_button = new QPushButton(); QPixmap title_pixmap(":/img/safe"); title_icon_label->setPixmap(title_pixmap); title_icon_label->setFixedSize(16, 16); title_icon_label->setScaledContents(true); close_button->loadPixmap(":/sysButton/close"); title_label->setFixedHeight(30); ok_button->setFixedSize(75, 25); QPixmap pixmap(":/img/360safe"); icon_label->setPixmap(pixmap); icon_label->setFixedSize(pixmap.size()); QHBoxLayout *title_layout = new QHBoxLayout(); title_layout->addWidget(title_icon_label, 0, Qt::AlignVCenter); title_layout->addWidget(title_label, 0, Qt::AlignVCenter); title_layout->addStretch(); title_layout->addWidget(close_button, 0, Qt::AlignTop); title_layout->setSpacing(5); title_layout->setContentsMargins(10, 0, 5, 0); QVBoxLayout *v_layout = new QVBoxLayout(); v_layout->addWidget(title_info_label); v_layout->addWidget(info_label); v_layout->addWidget(version_label); v_layout->addWidget(mummy_label); v_layout->addWidget(copyright_label); v_layout->addStretch(); v_layout->setSpacing(5); v_layout->setContentsMargins(0, 15, 0, 0); info_label->setContentsMargins(0, 0, 0, 40); QHBoxLayout *bottom_layout = new QHBoxLayout(); bottom_layout->addStretch(); bottom_layout->addWidget(ok_button); bottom_layout->setSpacing(0); bottom_layout->setContentsMargins(0, 0, 30, 20); QHBoxLayout *h_layout = new QHBoxLayout(); h_layout->addLayout(v_layout); h_layout->addWidget(icon_label); h_layout->setSpacing(0); h_layout->setContentsMargins(40, 0, 20, 10); QVBoxLayout *main_layout = new QVBoxLayout(); main_layout->addLayout(title_layout); main_layout->addStretch(); main_layout->addLayout(h_layout); main_layout->addLayout(bottom_layout); main_layout->setSpacing(0); main_layout->setContentsMargins(0, 0, 0, 0); setLayout(main_layout); title_label->setStyleSheet("color:white;"); copyright_label->setStyleSheet("color:gray;"); title_info_label->setStyleSheet("color:rgb(30,170,60);"); info_label->setStyleSheet("color:rgb(30,170,60);"); ok_button->setStyleSheet("QPushButton{border:1px solid lightgray; background:rgb(230,230,230);}" "QPushButton:hover{border-color:green; background:transparent;}"); QFont title_info_font("微软雅黑", 14, QFont::Bold, false); title_info_label->setFont(title_info_font); QFont info_font = info_label->font(); info_font.setBold(true); info_label->setFont(info_font); connect(ok_button, SIGNAL(clicked()), this, SLOT(hide())); connect(close_button, SIGNAL(clicked()), this, SLOT(hide())); this->translateLanguage(); }