day2 c语言学习 c++之qt图形化界面

完善登录界面
点击登录按钮后,判断账号(admin)和密码(123456)是否一致,如果匹配失败,则弹出错误对话框,文本内容账号密码不匹配,是否重新登录”,给定两个按钮k和cance,点击ok后,会清除密码框中的内容,继续进行登录,如果点击
cancel按钮,则关闭界面。如果账号和密码匹配,则弹出信息对话框,给出提示信息为“登录成功”给出一个按钮,点击k后,关闭整个登录界
面,跳转到其他界面点击取消按钮后,弹出问题对话框,询问是否确定要退出登录,给出两个按钮,yes/no,点击yes,则直接关闭整个登录界面,如果点击no则进行进行登录

头文件:

widget.h

#ifndef WIDGET_H
#define WIDGET_H

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

class Widget : public QWidget
{

private:
    Q_OBJECT

public slots:
    void exit_app();
    void get_speech();

signals:
    void jump();

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
    QLabel *label_logo;
    QPushButton *button1;
    QPushButton *button2;
    QLineEdit *line_edit1;
    QLineEdit *line_edit2;
    QLabel *label1;
    QLabel *label1_1;
    QLabel *label2;
    QLabel *label2_2;
    QCheckBox *check_box1;
    QCheckBox *check_box2;
    QPropertyAnimation *animation_button1;
    QTextToSpeech *my_speech;

    int valid_user();

};

class Second : public QWidget
{

private:
    Q_OBJECT

public slots:
void show_second();

public:
    Second(QWidget *parent = nullptr);
    ~Second();


};

#endif // WIDGET_H

主函数

main.cpp

#include "widget.h"
#include 

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    Widget w;
    w.show();
    Second s;
    QObject::connect(&w,SIGNAL(jump()),&s,SLOT(show_second()));

    return a.exec();
}

登录窗口

widget.cpp

现在可以触发键盘事件,如果按键回车可以直接登录,按键esc或者q可以退出

#include "widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{

    this->setFixedSize(600,450);
    qDebug("%d",this->width());
    qDebug("%d",this->height());

    this->setWindowIcon(QIcon(":/thinking_128.ico"));
    this->setWindowTitle("Jingyi's App");
    this->setFocusPolicy(Qt::StrongFocus);

    QFile file(":/MacOS.qss");
    file.open(QFile::ReadOnly);
    QTextStream filetext(&file);
    QString stylesheet = filetext.readAll();
    this->setStyleSheet(stylesheet);
    file.close();

    label_logo = new QLabel(this);
    label_logo->setGeometry(0,0,0,0);
    label_logo->resize(600,240);
    label_logo->setScaledContents(true);
    label_logo->setPixmap(QPixmap(":/Awake.png"));

    animation_button1 = new QPropertyAnimation();
    animation_button1->setEasingCurve(QEasingCurve::Linear);
    animation_button1->setTargetObject(this);
    animation_button1->setPropertyName("windowOpacity");
    animation_button1->setDuration(2000);
    animation_button1->setKeyValueAt(0, 0);
    animation_button1->setKeyValueAt(0.5, 0.5);
    animation_button1->setKeyValueAt(1, 1);
    animation_button1->setLoopCount(1);
    animation_button1->start();

    button1 = new QPushButton();
    button1->setParent(this);
    button1->setGeometry(100,400,0,0);
    button1->resize(160,40);
    button1->setText("Log in");
    connect(button1, SIGNAL(clicked()), this, SLOT(get_speech()));


    button2 = new QPushButton(this);
    button2->setParent(this);
    button2->setGeometry(300,400,0,0);
    button2->resize(160,40);
    button2->setText("Cancel");
    connect(button2, SIGNAL(clicked()), this, SLOT(exit_app()));
    //connect(button2, &QPushButton::clicked, this, &Widget::exit_app);

    line_edit1 = new QLineEdit(this);
    line_edit1->setGeometry(200,250,0,0);
    line_edit1->resize(320,40);
    line_edit1->setPlaceholderText("Username");

    line_edit2 = new QLineEdit(this);
    line_edit2->setGeometry(200,300,0,0);
    line_edit2->resize(320,40);
    line_edit2->setEchoMode(QLineEdit::Password);
    line_edit2->setPlaceholderText("Password");

    label1 = new QLabel(this);
    label1->setGeometry(50,250,0,0);
    label1->resize(120,40);
    label1->setText("Username:");

    label1_1 = new QLabel(this);
    label1_1->setGeometry(140,250,0,0);
    label1_1->resize(40,40);
    label1_1->setPixmap(QPixmap(":/user_24px.ico"));

    label2 = new QLabel(this);
    label2->setGeometry(50,300,0,0);
    label2->resize(120,40);
    label2->setText("Password:");

    label2_2 = new QLabel(this);
    label2_2->setGeometry(140,300,0,0);
    label2_2->resize(40,40);
    label2_2->setPixmap(QPixmap(":/lock_24px.ico"));

    check_box1 = new QCheckBox(this);
    check_box1->setGeometry(50,350,0,0);
    check_box1->resize(200,40);
    check_box1->setText("Forget password:");

    check_box2 = new QCheckBox(this);
    check_box2->setGeometry(250,350,0,0);
    check_box2->resize(200,40);
    check_box2->setText("Always logged in:");

    my_speech = new QTextToSpeech(this);

}

Widget::~Widget()
{
    delete animation_button1;
}

void Widget::exit_app()
{
    my_speech->say("knee yell lee cat ma");
    QMessageBox err_box(QMessageBox::Question,
                        "Question",
                        "Are you sure",
                        QMessageBox::Yes | QMessageBox::No,
                        this);
    int res = err_box.exec();
    if(res == QMessageBox::Yes){

        this->close();

    }else if(res == QMessageBox::No)
    {

    }
}

//1 means log in successfully, 0 means password not matching, -1 means no such user
int Widget::valid_user(){
    QString username = this->line_edit1->text();
    QString password = this->line_edit2->text();
    if(username == "admin")
    {
        if(password == "123456")  {
            return 1;
        }else{
            return 0;
        }
    }
    else
    {
        return -1;
    }
}

void Widget::get_speech(){

    if(valid_user() == 1){
        my_speech->say("knee hen new bee, lee high");
        QMessageBox suc_box(QMessageBox::Information,
                            "Success",
                            "You have logged in",
                            QMessageBox::Ok,
                            this);
        int res = suc_box.exec();
        if(res == QMessageBox::Ok){
            emit jump();
            this->close();
        }
    }
    else if(valid_user() == 0)
    {
        my_speech->say("me ma choy woo");
        QMessageBox err_box(QMessageBox::Critical,
                            "Error",
                            "Password is wrong",
                            QMessageBox::Ok | QMessageBox::Cancel,
                            this);
        int res = err_box.exec();
        if(res == QMessageBox::Ok){

            this->line_edit2->clear();

        }else if(res == QMessageBox::Cancel)
        {
            this->close();
        }

    }
    else if(valid_user() == -1)
    {
        my_speech->say("yong who choy woo");
        QMessageBox err_box(QMessageBox::Critical,
                            "Error",
                            "No such user",
                            QMessageBox::Ok | QMessageBox::Cancel,
                            this);
        int res = err_box.exec();
        if(res == QMessageBox::Ok){

            this->line_edit1->clear();

        }else if(res == QMessageBox::Cancel)
        {
            this->close();
        }
    }

}

void Widget::keyPressEvent(QKeyEvent *event){

    if(event->key() == Qt::Key_Return)
    {
        this->get_speech();
    }
    else if(event->key() == Qt::Key_Q || event->key() == Qt::Key_Escape)
    {
        this->exit_app();
    }

}

登录成功窗口

second.cpp

#include "widget.h"

Second::Second(QWidget *parent)
    : QWidget(parent)
{
    this->setFixedSize(600,450);
    this->setWindowIcon(QIcon(":/thinking_128.ico"));
    this->setWindowTitle("Jingyi's App");
    this->setFocusPolicy(Qt::StrongFocus);

    label1 = new QLabel(this);
    label1->setGeometry(300,250,0,0);
    label1->resize(40,40);
    label1->setScaledContents(true);
    label1->setPixmap(QPixmap(":/pig.png"));

}

Second::~Second()
{

}

void Second::show_second(){
    this->show();
}
void Second::keyPressEvent(QKeyEvent *event){

    if(event->key() == Qt::Key_A && this->label1->x() > 0)
    {
        this->label1->move(label1->x()-10,label1->y());
    }
    else if(event->key() == Qt::Key_D && this->label1->x() < this->width()-this->label1->width())
    {
        this->label1->move(label1->x()+10,label1->y());
    }
    else if(event->key() == Qt::Key_S && this->label1->y() < this->height()-this->label1->height())
    {
        this->label1->move(label1->x(),label1->y()+10);
    }
    else if(event->key() == Qt::Key_W && this->label1->y() > 0)
    {
        this->label1->move(label1->x(),label1->y()-10);
    }

}

附上附件:

我所有组件的央视文件

MacOs.qss

/*
 * MacOS Style Sheet for QT Applications
 * Author: Jaime A. Quiroga P.
 * Company: GTRONICK
 * Last updated: 25/12/2020, 23:10.
 * Available at: https://github.com/GTRONICK/QSS/blob/master/MacOS.qss
 */
QMainWindow {
    background-color:#ececec;
}
QPushButton, QToolButton, QCommandLinkButton{
    padding: 0 5px 0 5px;
    border-style: solid;
    border-top-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #c1c9cf, stop:1 #d2d8dd);
    border-right-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd);
    border-bottom-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd);
    border-left-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd);
    border-width: 2px;
    border-radius: 8px;
    color: #616161;
    font-weight: bold;
    background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #fbfdfd, stop:0.5 #ffffff, stop:1 #fbfdfd);
}
QPushButton::default, QToolButton::default, QCommandLinkButton::default{
    border: 2px solid transparent;
    color: #FFFFFF;
    background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #84afe5, stop:1 #1168e4);
}
QPushButton:hover, QToolButton:hover, QCommandLinkButton:hover{
    color: #3d3d3d;
}
QPushButton:pressed, QToolButton:pressed, QCommandLinkButton:pressed{
    color: #aeaeae;
    background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #ffffff, stop:0.5 #fbfdfd, stop:1 #ffffff);
}
QPushButton:disabled, QToolButton:disabled, QCommandLinkButton:disabled{
    color: #616161;
    background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #dce7eb, stop:0.5 #e0e8eb, stop:1 #dee7ec);
}
QLineEdit, QTextEdit, QPlainTextEdit, QSpinBox, QDoubleSpinBox, QTimeEdit, QDateEdit, QDateTimeEdit {
    border-width: 2px;
    border-radius: 8px;
    border-style: solid;
    border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd);
    border-right-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd);
    border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #c1c9cf, stop:1 #d2d8dd);
    border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd);
    background-color: #f4f4f4;
    color: #3d3d3d;
}
QLineEdit:focus, QTextEdit:focus, QPlainTextEdit:focus, QSpinBox:focus, QDoubleSpinBox:focus, QTimeEdit:focus, QDateEdit:focus, QDateTimeEdit:focus {
    border-width: 2px;
    border-radius: 8px;
    border-style: solid;
    border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 #85b7e3, stop:1 #9ec1db);
    border-right-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #85b7e3, stop:1 #9ec1db);
    border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #85b7e3, stop:1 #9ec1db);
    border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 #85b7e3, stop:1 #9ec1db);
    background-color: #f4f4f4;
    color: #3d3d3d;
}
QLineEdit:disabled, QTextEdit:disabled, QPlainTextEdit:disabled, QSpinBox:disabled, QDoubleSpinBox:disabled, QTimeEdit:disabled, QDateEdit:disabled, QDateTimeEdit:disabled {
    color: #b9b9b9;
}
QSpinBox::up-button, QDoubleSpinBox::up-button, QTimeEdit::up-button, QDateEdit::up-button, QDateTimeEdit::up-button {
    subcontrol-origin: padding;
    subcontrol-position: top right;
    width: 15px;
    color: #272727;
    border-left-width: 1px;
    border-left-color: darkgray;
    border-left-style: solid;
    border-top-right-radius: 3px;
    padding: 3px;
}
QSpinBox::down-button, QDoubleSpinBox::down-button, QTimeEdit::down-button, QDateEdit::down-button, QDateTimeEdit::down-button {
    subcontrol-origin: padding;
    subcontrol-position: bottom right;
    width: 15px;
    color: #272727;
    border-left-width: 1px;
    border-left-color: darkgray;
    border-left-style: solid;
    border-bottom-right-radius: 3px;
    padding: 3px;
}
QSpinBox::up-button:pressed, QDoubleSpinBox::up-button:pressed, QTimeEdit::up-button:pressed, QDateEdit::up-button:pressed, QDateTimeEdit::up-button:pressed {
    color: #aeaeae;
    background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #ffffff, stop:0.5 #fbfdfd, stop:1 #ffffff);
}
QSpinBox::down-button:pressed, QDoubleSpinBox::down-button:pressed, QTimeEdit::down-button:pressed, QDateEdit::down-button:pressed, QDateTimeEdit::down-button:pressed {
    color: #aeaeae;
    background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #ffffff, stop:0.5 #fbfdfd, stop:1 #ffffff);
}
QSpinBox::up-button:hover, QDoubleSpinBox::up-button:hover, QTimeEdit::up-button:hover, QDateEdit::up-button:hover, QDateTimeEdit::up-button:hover {
    color: #FFFFFF;
    border-top-right-radius: 5px;
    background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #84afe5, stop:1 #1168e4);
    
}
QSpinBox::down-button:hover, QDoubleSpinBox::down-button:hover, QTimeEdit::down-button:hover, QDateEdit::down-button:hover, QDateTimeEdit::down-button:hover {
    color: #FFFFFF;
    border-bottom-right-radius: 5px;
    background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #84afe5, stop:1 #1168e4);
}
QSpinBox::up-arrow, QDoubleSpinBox::up-arrow, QTimeEdit::up-arrow, QDateEdit::up-arrow, QDateTimeEdit::up-arrow {
    image: url(/usr/share/icons/Adwaita/16x16/actions/go-up-symbolic.symbolic.png);
}
QSpinBox::down-arrow, QDoubleSpinBox::down-arrow, QTimeEdit::down-arrow, QDateEdit::down-arrow, QDateTimeEdit::down-arrow {
    image: url(/usr/share/icons/Adwaita/16x16/actions/go-down-symbolic.symbolic.png);
}
QProgressBar {
    max-height: 8px;
    text-align: center;
    font: italic bold 11px;
    color: #3d3d3d;
    border: 1px solid transparent;
    border-radius:4px;
    background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #ddd5d5, stop:0.5 #dad3d3, stop:1 #ddd5d5);
}
QProgressBar::chunk {
    background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #467dd1, stop:0.5 #3b88fc, stop:1 #467dd1);
    border-radius: 4px;
}
QProgressBar:disabled {
    color: #616161;
}
QProgressBar::chunk:disabled {
    background-color: #aeaeae;
}
QSlider::groove {
    border: 1px solid #bbbbbb;
    background-color: #52595d;
    border-radius: 4px;
}
QSlider::groove:horizontal {
    height: 6px;
}
QSlider::groove:vertical {
    width: 6px;
}
QSlider::handle:horizontal {
    background: #ffffff;
    border-style: solid;
    border-width: 1px;
    border-color: rgb(207,207,207);
    width: 12px;
    margin: -5px 0;
    border-radius: 7px;
}
QSlider::handle:vertical {
    background: #ffffff;
    border-style: solid;
    border-width: 1px;
    border-color: rgb(207,207,207);
    height: 12px;
    margin: 0 -5px;
    border-radius: 7px;
}
QSlider::add-page, QSlider::sub-page {
    border: 1px transparent;
    background-color: #52595d;
    border-radius: 4px;
}
QSlider::add-page:horizontal {
    background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #ddd5d5, stop:0.5 #dad3d3, stop:1 #ddd5d5);
}
QSlider::sub-page:horizontal {
    background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #467dd1, stop:0.5 #3b88fc, stop:1 #467dd1);
}
QSlider::add-page:vertical {
    background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #467dd1, stop:0.5 #3b88fc, stop:1 #467dd1);
}
QSlider::sub-page:vertical {
    background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #ddd5d5, stop:0.5 #dad3d3, stop:1 #ddd5d5);
}
QSlider::add-page:horizontal:disabled, QSlider::sub-page:horizontal:disabled, QSlider::add-page:vertical:disabled, QSlider::sub-page:vertical:disabled {
    background: #b9b9b9;
}
QComboBox, QFontComboBox {
    border-width: 2px;
    border-radius: 8px;
    border-style: solid;
    border-top-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd);
    border-right-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd);
    border-bottom-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #c1c9cf, stop:1 #d2d8dd);
    border-left-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:0, stop:0 #c1c9cf, stop:1 #d2d8dd);
    background-color: #f4f4f4;
    color: #272727;
    padding-left: 5px;
}
QComboBox:editable, QComboBox:!editable, QComboBox::drop-down:editable, QComboBox:!editable:on, QComboBox::drop-down:editable:on {
    background: #ffffff;
}
QComboBox::drop-down {
    subcontrol-origin: padding;
    subcontrol-position: top right;
    width: 15px;
    color: #272727;
    border-left-width: 1px;
    border-left-color: darkgray;
    border-left-style: solid;
    border-top-right-radius: 3px;
    border-bottom-right-radius: 3px;
}
QComboBox::down-arrow {
    image: url(/usr/share/icons/Adwaita/16x16/actions/go-down-symbolic.symbolic.png); /*Adawaita icon thene*/
}

QComboBox::down-arrow:on {
    top: 1px;
    left: 1px;
}
QComboBox QAbstractItemView {
    border: 1px solid darkgray;
    border-radius: 8px;
    selection-background-color: #dadada;
    selection-color: #272727;
    color: #272727;
    background: white;
}
QLabel, QCheckBox, QRadioButton {
    color: #272727;
}
QCheckBox {
    padding: 2px;
}
QCheckBox:disabled, QRadioButton:disabled {
    color: #808086;
    padding: 2px;
}

QCheckBox:hover {
    border-radius:4px;
    border-style:solid;
    padding-left: 1px;
    padding-right: 1px;
    padding-bottom: 1px;
    padding-top: 1px;
    border-width:1px;
    border-color: transparent;
}
QCheckBox::indicator:checked {
    image: url(/usr/share/icons/Adwaita/16x16/actions/object-select-symbolic.symbolic.png);
    height: 15px;
    width: 15px;
    border-style:solid;
    border-width: 1px;
    border-color: #48a5fd;
    color: #ffffff;
    border-radius: 3px;
    background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #48a5fd, stop:0.5 #329cfb, stop:1 #48a5fd);
}
QCheckBox::indicator:unchecked {
    
    height: 15px;
    width: 15px;
    border-style:solid;
    border-width: 1px;
    border-color: #48a5fd;
    border-radius: 3px;
    background-color: #fbfdfa;
}
QLCDNumber {
    color: #616161;;
}
QMenuBar {
    background-color: #ececec;
}
QMenuBar::item {
    color: #616161;
    spacing: 3px;
    padding: 1px 4px;
    background-color: #ececec;
}

QMenuBar::item:selected {
    background-color: #dadada;
    color: #3d3d3d;
}
QMenu {
    background-color: #ececec;
}
QMenu::item:selected {
    background-color: #dadada;
    color: #3d3d3d;
}
QMenu::item {
    color: #616161;;
    background-color: #e0e0e0;
}
QTabWidget {
    color:rgb(0,0,0);
    background-color:#000000;
}
QTabWidget::pane {
    border-color: #050a0e;
    background-color: #e0e0e0;
    border-width: 1px;
    border-radius: 4px;
    position: absolute;
    top: -0.5em;
    padding-top: 0.5em;
}

QTabWidget::tab-bar {
    alignment: center;
}

QTabBar::tab {
    border-bottom: 1px solid #c0c0c0;
    padding: 3px;
    color: #272727;
    background-color: #fefefc;
    margin-left:0px;
}
QTabBar::tab:!last {
    border-right: 1px solid;
    border-right-color: #c0c0c0;
    border-bottom-color: #c0c0c0;
}
QTabBar::tab:first {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}
QTabBar::tab:last {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}
QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover {
    color: #FFFFFF;
    background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #84afe5, stop:1 #1168e4);
}
QRadioButton::indicator {
    height: 14px;
    width: 14px;
    border-style:solid;
    border-radius:7px;
    border-width: 1px;
}
QRadioButton::indicator:checked {
    border-color: #48a5fd;
    background-color: qradialgradient(cx:0.5, cy:0.5, radius:0.4,fx:0.5, fy:0.5, stop:0 #ffffff, stop:0.5 #ffffff, stop:0.6 #48a5fd, stop:1 #48a5fd);
}
QRadioButton::indicator:!checked {
    border-color: #a9b7c6;
    background-color: #fbfdfa;
}
QStatusBar {
    color:#027f7f;
}

QDial {
    background: #16a085;
}

QToolBox {
    color: #a9b7c6;
    background-color: #222b2e;
}
QToolBox::tab {
    color: #a9b7c6;
    background-color:#222b2e;
}
QToolBox::tab:selected {
    color: #FFFFFF;
    background-color:#222b2e;
}
QScrollArea {
    color: #FFFFFF;
    background-color:#222b2e;
}

QScrollBar:horizontal {
	max-height: 10px;
	border: 1px transparent grey;
	margin: 0px 20px 0px 20px;
	background: transparent;
}
QScrollBar:vertical {
	max-width: 10px;
	border: 1px transparent grey;
	margin: 20px 0px 20px 0px;
	background: transparent;
}
QScrollBar::handle:vertical, QScrollBar::handle:horizontal {
	background: #52595d;
	border-style: transparent;
	border-radius: 4px;
	min-height: 25px;
}
QScrollBar::handle:horizontal:hover, QScrollBar::handle:vertical:hover {
	background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #467dd1, stop:0.5 #3b88fc, stop:1 #467dd1);
}
QScrollBar::add-line, QScrollBar::sub-line {
    border: 2px transparent grey;
    border-radius: 4px;
    subcontrol-origin: margin;
    background: #b9b9b9;
}
QScrollBar::add-line:horizontal {
    width: 20px;
    subcontrol-position: right;
}
QScrollBar::add-line:vertical {
    height: 20px;
    subcontrol-position: bottom;
}
QScrollBar::sub-line:horizontal {
    width: 20px;
    subcontrol-position: left;
}
QScrollBar::sub-line:vertical {
    height: 20px;
    subcontrol-position: top;
}
QScrollBar::add-line:vertical:pressed, QScrollBar::add-line:horizontal:pressed, QScrollBar::sub-line:horizontal:pressed, QScrollBar::sub-line:vertical:pressed {
    background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #467dd1, stop:0.5 #3b88fc, stop:1 #467dd1);
}
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal, QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
    background: none;
}
QScrollBar::up-arrow:vertical {
    image: url(/usr/share/icons/Adwaita/16x16/actions/go-up-symbolic.symbolic.png);
}
QScrollBar::down-arrow:vertical {
    image: url(/usr/share/icons/Adwaita/16x16/actions/go-down-symbolic.symbolic.png);
}
QScrollBar::left-arrow:horizontal {
    image: url(/usr/share/icons/Adwaita/16x16/actions/go-previous-symbolic.symbolic.png);
}
QScrollBar::right-arrow:horizontal {
    image: url(/usr/share/icons/Adwaita/16x16/actions/go-next-symbolic.symbolic.png);
}

你可能感兴趣的:(学习,c++,开发语言)