diff --git a/Qss.cpp b/Qss.cpp new file mode 100644 index 0000000..5c8b1d0 --- /dev/null +++ b/Qss.cpp @@ -0,0 +1,1500 @@ +/** +* @file: QssTtitleBar.h +* @details: cssUI +* @author: chenwen(chenwen1126@tom.com) +* @datetime: 2017-7-25 +* @history: v1.0 first edition(Qt4.7) +*/ +#include "Qss.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define QSSDIALOG_SHADOW_WIDTH 12 //QFrame#dialog,QFrame#messagebox padding +#define QSSDIALOG_BODER_WIDTH 0 + +QssTtitleBar::QssTtitleBar(QWidget *parent , QTitleBar_Type type/* = QTitleBar_Type_Window*/) + : QWidget(parent),m_maxOrRestore(false),m_pressed(false),m_type(type),m_Main(nullptr) +{ + setObjectName("titlebar"); + + m_closeBtn = new QPushButton(this);// + m_closeBtn->setObjectName("titlebarclosebtn");//css + m_closeBtn->setToolTip(QString::fromLocal8Bit("")); + m_closeBtn->setVisible(m_type & QTitleBar_Button_Close); + + m_minBtn = new QPushButton(this); + m_minBtn->setObjectName("titlebarminbtn");//css + m_minBtn->setToolTip(QString::fromLocal8Bit("最大化")); + m_minBtn->setVisible(m_type & QTitleBar_Button_Min); + + m_restoreBtn = new QPushButton(this);// + m_restoreBtn->setObjectName("titlebarrestorebtn");//css + m_restoreBtn->setToolTip(QString::fromLocal8Bit("")); + m_restoreBtn->setVisible(m_type & QTitleBar_Button_Restore); + + m_maxBtn = new QPushButton(this);//normal + m_maxBtn->setObjectName("titlebarmaxbtn");//css + m_maxBtn->setToolTip(QString::fromLocal8Bit("")); + m_maxBtn->setVisible(m_type & QTitleBar_Button_Max); + + m_iconBtn = new QPushButton(this);// + m_iconBtn->setObjectName("titlebaricon");//css + + m_titlebarTitle = new QLabel(this);// + m_titlebarTitle->setObjectName("titlebartitle");//css + m_titlebarTitle->setStyleSheet("color: white;margin-left:4px;font-size:15px;"); + QHBoxLayout* hBox = new QHBoxLayout(this); + hBox->setMargin(0); + hBox->addWidget(m_iconBtn); + hBox->addWidget(m_titlebarTitle); + hBox->addStretch(1); + hBox->addWidget(m_minBtn); + hBox->addWidget(m_restoreBtn); + m_restoreBtn->setVisible(m_maxOrRestore);// + hBox->addWidget(m_maxBtn); + hBox->addWidget(m_closeBtn); + + hBox->setSpacing(0); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);// + + connect(m_closeBtn, SIGNAL(clicked()), parent, SLOT(close()));// + connect(m_minBtn, SIGNAL(clicked()), parent, SLOT(showMinimized())); + connect(m_maxBtn, SIGNAL(clicked()), this, SLOT(onMaxOrRestore()));// + connect(m_restoreBtn, SIGNAL(clicked()), this, SLOT(onMaxOrRestore())); + + m_iconBtn->installEventFilter(this);//m_iconLab + installEventFilter(this);// + + m_rcValid = QApplication::desktop()->availableGeometry(); + this->setFixedHeight(30); + setWindowFlags(windowFlags()| + Qt::MSWindowsFixedSizeDialogHint); + this->setGeometry(parent->geometry().x(),parent->geometry().y(),0,0); +} + +QssTtitleBar::~QssTtitleBar() +{ +} + +void QssTtitleBar::setTitle( QString title ) +{ + m_titlebarTitle->setText(title); +} + +void QssTtitleBar::setIcon( QIcon icon) +{ + m_iconBtn->setIcon(icon); +} + +void QssTtitleBar::setMaxOrRestore( bool val) +{ + m_maxOrRestore = val;//true + + if ((m_type & QTitleBar_Button_Restore) && (m_type & QTitleBar_Button_Max)) + { + m_restoreBtn->setVisible(m_maxOrRestore); + m_maxBtn->setVisible(!m_maxOrRestore); + } +} + +void QssTtitleBar::SetMainWindow(QMainWindow *p) +{ + if(nullptr ==p){ + return; + } + this->m_Main = p; +} + +/** m_maxNormaltrue */ +void QssTtitleBar::onMaxOrRestore() +{ + if (m_type != QTitleBar_Type_MainWindow) + return ; + + if (m_maxOrRestore) + { + if (!m_rcNormal.isValid()) + { + QSize sizeHint = parentWidget()->sizeHint(); + if (sizeHint.width() > m_rcValid.width()) + sizeHint.setWidth(m_rcValid.width() -100); + if (sizeHint.height() > m_rcValid.height()) + sizeHint.setHeight(m_rcValid.height() - 100); + + m_rcNormal.setLeft((m_rcValid.width() - sizeHint.width())/2); + m_rcNormal.setTop((m_rcValid.height() - sizeHint.height())/2); + m_rcNormal.setWidth(sizeHint.width()); + m_rcNormal.setHeight(sizeHint.height()); + } + parentWidget()->setGeometry(m_rcNormal); + + } + else + { + QDesktopWidget desktop; + QRect rc = desktop.availableGeometry(-1); + QRect curRcMain = m_Main->geometry(); + QRect curRcFrame = parentWidget()->geometry(); + QRect curRcCentral = m_Main->centralWidget()->geometry(); + + qDebug()<<"current geometry is "<geometry(); + if (rc.width() < m_rcValid.width() && rc.height() < m_rcValid.height()) + m_rcNormal = rcFrame; + qDebug()<<"parent is"<objectName()<objectName(); + + parentWidget()->setGeometry(rc); + this->m_Main->setGeometry(rc); + m_Main->centralWidget()->setGeometry(rc); + + curRcMain = m_Main->geometry(); + curRcFrame = parentWidget()->geometry(); + curRcCentral = m_Main->centralWidget()->geometry(); + + qDebug()<<"current geometry is "<drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} + +void QssTtitleBar::mouseMoveEvent( QMouseEvent * ev ) +{ + if (m_maxOrRestore) + return; + if (!m_pressed) + return; + + QPoint globalPt = ev->globalPos(); + QPoint movePt = globalPt - m_pressedPos;//FrameglobalPos + parentWidget()->move(movePt);//globalPos + + return ; +} + +void QssTtitleBar::mousePressEvent( QMouseEvent * ev ) +{ + m_pressed = true; + m_pressedPos = mapToParent(ev->pos()); + + return ; +} + +void QssTtitleBar::mouseReleaseEvent( QMouseEvent * ev ) +{ + m_pressed = false; +} + +bool QssTtitleBar::eventFilter( QObject * obj, QEvent * ev ) +{ + if (obj == this) + { + if (ev->type() == QEvent::MouseButtonDblClick) + { + onMaxOrRestore(); + return true; + } + } + else if (obj == m_iconBtn) + { + /* + if (ev->type() == QEvent::MouseButtonDblClick) + { + parentWidget()->close(); + return true; + }*/ + } + + return QWidget::eventFilter(obj, ev); +} + +QssMainWindow::QssMainWindow(QWidget *parent/* = 0*/, Qt::WindowFlags flags/* = 0*/) +: QMainWindow(parent, flags),m_mousePressedInBoundy(false),m_bLeftPress(false) +{ + m_rcValid = QApplication::desktop()->availableGeometry(); + + m_frame = new QFrame(parent, flags); + //css + m_frame->setObjectName("window"); + + m_frame->setWindowFlags(Qt::Window | Qt::FramelessWindowHint| Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint); + m_frame->setMouseTracking(true); + m_frame->installEventFilter(this); + + + m_titleBar = new QssTtitleBar(m_frame); + m_titleBar->installEventFilter(this); + m_titleBar->SetMainWindow(this); + QVBoxLayout* vbox = new QVBoxLayout(m_frame); + vbox->addWidget(m_titleBar); + vbox->setMargin(2); + vbox->setSpacing(0); + vbox->addWidget(this); + vbox->addStretch(); + vbox->setSpacing(0); + vbox->addStretch(); + + + qDebug()<children()[0]->objectName(); + installEventFilter(this); +} + +QssMainWindow::~QssMainWindow() +{ + m_frame->deleteLater(); +} + +void QssMainWindow::show() +{ + m_frame->show(); +} + +void QssMainWindow::showMinimized() +{ + m_frame->showMinimized(); +} + + +enum { + TOPLEFT = 11, + TOP = 12, + TOPRIGHT = 13, + LEFT = 21, + CENTER = 22, + RIGHT = 23, + BUTTOMLEFT = 31, + BUTTOM = 32, + BUTTOMRIGHT = 33 +}; + + +void QssMainWindow::setCursorShape(int CalPos) +{ + Qt::CursorShape cursor; + switch(CalPos) + { + case TOPLEFT: + case BUTTOMRIGHT: + cursor = Qt::SizeFDiagCursor; + break; + case TOPRIGHT: + case BUTTOMLEFT: + cursor = Qt::SizeBDiagCursor; + break; + case TOP: + case BUTTOM: + cursor = Qt::SizeVerCursor; + break; + case LEFT: + case RIGHT: + cursor = Qt::SizeHorCursor; + break; + default: + cursor = Qt::ArrowCursor; + break; + } + setCursor(cursor); +} + +void QssMainWindow::showMaximized() +{ + m_titleBar->setMaxOrRestore(true); + m_frame->setGeometry(m_rcValid); +} + +void QssMainWindow::showFullScreen() +{ + m_titleBar->setMaxOrRestore(true); + m_frame->showFullScreen(); + this->showFullScreen(); + this->centralWidget()->showFullScreen(); +} + +void QssMainWindow::showNormal() +{ + m_titleBar->setMaxOrRestore(false); + m_frame->resize(rect().width(), rect().height() + m_titleBar->rect().height()); + m_frame->showNormal(); +} + +void QssMainWindow::setWindowTitle( QString title ) +{ + m_frame->setWindowTitle(title); + m_titleBar->setTitle(title); +} + +void QssMainWindow::setWindowIcon( QIcon icon ) +{ + m_frame->setWindowIcon(icon); + m_titleBar->setIcon(icon); +} +#define FRAMESHAPE 10 + +int QssMainWindow::CalCursorPos(QPoint pt, int colPos) +{ + return ((pt.y() < FRAMESHAPE ? 10 : ((pt.y() > this->height() - FRAMESHAPE) ? 30 : 20)) + colPos); +} + +int QssMainWindow::CalCursorCol(QPoint pt) +{ + return (pt.x() < FRAMESHAPE ? 1 : ((pt.x() > this->width() - FRAMESHAPE) ? 3 : 2)); +} + + +void QssMainWindow::onMouseMoveEvent( QMouseEvent * ev ) +{ + QObjectList t = this->children(); + foreach(auto obj,t){ + qDebug()<<"object name"<objectName(); + } + + if (m_titleBar->maxOrRestore()) + { + return; + } + if(Qt::WindowMaximized != windowState()) + { + setCursorShape(CalCursorPos(ev->pos(),CalCursorCol(ev->pos()))); + } + QPoint ptCurrentPos = QCursor::pos(); + QPoint ptMoveSize = ptCurrentPos - m_ptViewMousePos; + QRect rtTempGeometry = this->geometry(); + QRect rtCentralGeo = this->centralWidget()->geometry(); + QRect rtMainWindow = this->geometry(); + setCursor(Qt::ArrowCursor); + if (m_mousePressedInBoundy) + { + int x = ev->globalPos().x(); + int y = ev->globalPos().y(); + + int dx = x - m_pos.x(); + int dy = y - m_pos.y(); + + if ((m_left || m_right) && qAbs(dx) < 5) + return; + if ((m_top || m_bottom) && qAbs(dy) < 5) + return; + if (m_left && dx > 0 && m_rect.width() <= m_frame->minimumWidth()) + return ; + if (m_top && dy > 0 && m_rect.height() <= m_frame->minimumHeight()) + return; + + QRect rc = m_rect; + if (m_left){ + rc.setLeft(rc.left() + dx); + rtCentralGeo.setLeft(rtCentralGeo.left() + dx); + rtMainWindow.setLeft(rtMainWindow.left() + dx); + } + if (m_right){ + rc.setRight(rc.right() + dx); + rtCentralGeo.setRight(rtCentralGeo.right() + dx); + rtMainWindow.setRight(rtMainWindow.right() + dx); + } + if (m_top){ + rc.setTop(rc.top() + dy); + rtCentralGeo.setTop(rtCentralGeo.top() + dy); + rtMainWindow.setTop(rtMainWindow.top() + dy); + } + if (m_bottom){ + rc.setBottom(rc.bottom() + dy); + rtCentralGeo.setBottom(rtCentralGeo.bottom() + dy); + rtMainWindow.setBottom(rtMainWindow.bottom() + dy); + } + QObjectList t = m_frame->children(); + foreach(auto obj,t){ + qDebug()<<"m_frame children name is "<objectName(); + } + + this->centralWidget()->raise(); + this->centralWidget()->setGeometry(rtCentralGeo); + m_frame->setGeometry(rc); + m_frame->show(); + this->setGeometry(rtMainWindow); + this->show(); + qDebug()<<"parent is "<parent(); + qDebug()<<"resize set geometry "<globalPos(); + } + else + { + int x = ev->x(); + int y = ev->y(); + + QRect rc = m_frame->rect(); + m_left = qAbs(x - rc.left()) <= 5; + m_right = qAbs(x - rc.right()) <= 5; + m_top = qAbs(y - rc.top()) <= 5; + m_bottom = qAbs(y - rc.bottom()) <= 5; + + if ((m_left && m_top) || (m_right && m_bottom)) + m_frame->setCursor(Qt::SizeFDiagCursor); + else if ((m_right && m_top) || (m_left && m_bottom)) + m_frame->setCursor(Qt::SizeBDiagCursor); + else if ((m_left && !m_top && !m_bottom) || (m_right && !m_top && !m_bottom)) + m_frame->setCursor(Qt::SizeHorCursor); + else if ((m_top && !m_right && !m_left) || (m_bottom && !m_right && !m_left)) + m_frame->setCursor(Qt::SizeVerCursor); + else + m_frame->setCursor(Qt::ArrowCursor); + } +} + +void QssMainWindow::onMousePressEvent( QMouseEvent * ev ) +{ + qDebug("mouse press"); + + m_pos = ev->globalPos(); + this->show(); + m_rect = m_frame->geometry(); + if(nullptr != centralWidget()){ + m_CentralRect = centralWidget()->geometry(); + } + m_mousePressedInBoundy = (ev->button() == Qt::LeftButton) && (m_left || m_right || m_top || m_bottom); + + m_iCalCursorPos = CalCursorPos(ev->pos(),CalCursorCol(ev->pos())); + if (ev->button() == Qt::LeftButton) + { + if(m_iCalCursorPos != CENTER) + { + m_bLeftPress = true; + m_ptViewMousePos = ev->globalPos(); + setCursor(Qt::ArrowCursor); + } + } + m_rtPreGeometry = m_rect; + qDebug("frame geometry is %d %d %d %d",m_rect.x(),m_rect.y(), + m_rect.width(),m_rect.height()); +} + +void QssMainWindow::onMouseReleaseEvent( QMouseEvent * ev ) +{ + qDebug("mouse release"); + m_bLeftPress = false; + m_mousePressedInBoundy = false; +} + +bool QssMainWindow::eventFilter( QObject * obj, QEvent * ev ) +{ + if (obj == m_frame) + { + if (ev->type() == QEvent::MouseMove) + { + QMouseEvent * mouseEv = dynamic_cast(ev); + if (ev) + { + onMouseMoveEvent(mouseEv); + return true; + } + } + else if (ev->type() == QEvent::MouseButtonPress) + { + qDebug()<<"mouse button pressed\r\n"; + QMouseEvent * mouseEv = dynamic_cast(ev); + if (ev) + { + onMousePressEvent(mouseEv); + return true; + } + } + else if (ev->type() == QEvent::MouseButtonRelease) + { + setCursor(Qt::ArrowCursor); + + QMouseEvent * mouseEv = dynamic_cast(ev); + if (ev) + { + onMouseReleaseEvent(mouseEv); + return true; + } + } + else if (ev->type() == QEvent::Show) + { + /* */ + QRect rc = m_frame->rect(); + QRect parentRc = m_rcValid; + + /** m_frame */ + int x = parentRc.left() + (parentRc.width() - rc.width())*0.5; x = x <= 0 ? 1 : x; + int y = parentRc.top() + (parentRc.height() - rc.height())*0.5; y = y <= 0 ? 1 : y; + m_frame->move(x, y); + } + else if (ev->type() == QEvent::Close) + { + close(); + m_titleBar->close(); + + return true; + } + } + else if (obj == m_titleBar) + { + if (ev->type() == QEvent::Enter) + { + m_left = false;m_right = false; m_top = false; m_bottom = false; + if (m_frame->cursor().shape() != Qt::ArrowCursor) + m_frame->setCursor(Qt::ArrowCursor); + } + } + else if (obj == this) + { + if (ev->type() == QEvent::Enter) + { + m_left = false;m_right = false; m_top = false; m_bottom = false; + if (m_frame->cursor().shape() != Qt::ArrowCursor) + m_frame->setCursor(Qt::ArrowCursor); + } + if(QEvent::Resize == ev->type()){ + qDebug()<<"resized sended"<objectName(); + QRect rtTempGeometry = this->frameGeometry(); + qDebug("re geomotry size is %d %d %d %d",rtTempGeometry.x(), + rtTempGeometry.y(),rtTempGeometry.width(),rtTempGeometry.height()); + this->setGeometry(rtTempGeometry.x(),rtTempGeometry.y(),rtTempGeometry.width(),rtTempGeometry.height()); + } + else if (ev->type() == QEvent::MouseButtonRelease) + { + setCursor(Qt::ArrowCursor); + QMouseEvent * mouseEv = dynamic_cast(ev); + if (ev) + { + onMouseReleaseEvent(mouseEv); + return true; + } + } + } + if(QEvent::Resize == ev->type()){ + QDesktopWidget desktop; + QRect sizeHint = desktop.availableGeometry(-1); + + } + return QMainWindow::eventFilter(obj, ev); +} + +QssDialog::QssDialog(QWidget *parent) + : QDialog(0), + m_mousePressedInBorder(false), + m_parent(parent) +{ + m_rcValid = QApplication::desktop()->availableGeometry(); + + m_frame = new QFrame(parent); + m_frame->setObjectName("dialog");//css + m_frame->setAttribute(Qt::WA_TranslucentBackground); + m_frame->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint| Qt::WindowSystemMenuHint/* | Qt::WindowMinimizeButtonHint*/);//Qt::WindowMinimizeButtonHintdialog�� + m_frame->setMouseTracking(true); + m_frame->installEventFilter(this); + + m_titleBar = new QssTtitleBar(m_frame, QssTtitleBar::QTitleBar_Type_Dialog); + m_titleBar->installEventFilter(this); + + QVBoxLayout* vbox = new QVBoxLayout(m_frame); + vbox->setMargin(0); + vbox->setSpacing(0); + vbox->addWidget(m_titleBar); + vbox->addWidget(this); + + installEventFilter(this); +} + +QssDialog::~QssDialog() +{ + m_frame->deleteLater(); +} + +void QssDialog::show() +{ + /** resize m_framem_framesizehint */ + int offset = (QSSDIALOG_SHADOW_WIDTH + QSSDIALOG_BODER_WIDTH)*2; + m_frame->resize(rect().width() + offset, rect().height() + m_titleBar->rect().height() + offset); + + QDialog::show(); + m_frame->show(); +} +void QssDockWidget::paintEvent(QPaintEvent *){ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} + +void QssDockWidget::show() +{ + /** resize m_framem_framesizehint */ + int offset = (QSSDIALOG_SHADOW_WIDTH + QSSDIALOG_BODER_WIDTH)*2;//rect()����padding��paddingframe + m_frame->resize(rect().width() + offset, rect().height() + m_titleBar->rect().height() + offset); + + QDockWidget::show(); + m_frame->show(); + //m_titleBar->show(); +} + +void QssDialog::raise() +{ + m_frame->raise(); +} + +void QssDialog::activateWindow() +{ + m_frame->activateWindow(); +} + +int QssDialog::exec() +{ + /** resize m_framem_framesizehint */ + int offset = (QSSDIALOG_SHADOW_WIDTH + QSSDIALOG_BODER_WIDTH)*2;//rect()����padding��paddingframe + m_frame->resize(rect().width() + offset, rect().height() + m_titleBar->rect().height() + offset); + + m_frame->setWindowModality(Qt::ApplicationModal);//Qt::ApplicationModal + //m_frame->setWindowFlags(m_frame->windowFlags() | Qt::Tool);//Qt::Tool + + m_frame->show(); + m_frame->raise(); + m_frame->activateWindow(); + + int ret = QDialog::exec(); + m_frame->close(); + + return ret; +} + +void QssDialog::setWindowTitle( QString title ) +{ + m_frame->setWindowTitle(title); + m_titleBar->setTitle(title); +} + +void QssDialog::setWindowIcon( QIcon icon ) +{ + m_frame->setWindowIcon(icon); + m_titleBar->setIcon(icon); +} + +void QssDialog::onMouseMoveEvent( QMouseEvent * ev ) +{ + if (m_mousePressedInBorder) + { + int x = ev->globalPos().x(); + int y = ev->globalPos().y(); + + int dx = x - m_pos.x(); + int dy = y - m_pos.y(); + + if ((m_left || m_right) && qAbs(dx) < 5) + return; + if ((m_top || m_bottom) && qAbs(dy) < 5) + return; + if (m_left && dx > 0 && m_rect.width() <= m_frame->minimumWidth()) + return ; + if (m_top && dy > 0 && m_rect.height() <= m_frame->minimumHeight()) + return; + + QRect rc = m_rect; + if (m_left) + rc.setLeft(rc.left() + dx); + if (m_right) + rc.setRight(rc.right() + dx); + if (m_top) + rc.setTop(rc.top() + dy); + if (m_bottom) + rc.setBottom(rc.bottom() + dy); + + m_frame->setGeometry(rc); + m_rect = rc; + m_pos = ev->globalPos(); + } + else + { + int x = ev->x() + QSSDIALOG_SHADOW_WIDTH - 2; + int y = ev->y() + QSSDIALOG_SHADOW_WIDTH - 2; + + QRect rc = m_frame->rect(); + m_left = qAbs(x - rc.left()) <= 5; + m_right = qAbs(x - rc.right()) <= 5; + m_top = qAbs(y - rc.top()) <= 5; + m_bottom = qAbs(y - rc.bottom()) <= 5; + + if ((m_left && m_top) || (m_right && m_bottom)) + m_frame->setCursor(Qt::SizeFDiagCursor); + else if ((m_right && m_top) || (m_left && m_bottom)) + m_frame->setCursor(Qt::SizeBDiagCursor); + else if ((m_left && !m_top && !m_bottom) || (m_right && !m_top && !m_bottom)) + m_frame->setCursor(Qt::SizeHorCursor); + else if ((m_top && !m_right && !m_left) || (m_bottom && !m_right && !m_left)) + m_frame->setCursor(Qt::SizeVerCursor); + else + m_frame->setCursor(Qt::ArrowCursor); + } +} + +void QssDockWidget::onMouseMoveEvent( QMouseEvent * ev ) +{ + if (m_mousePressedInBorder) + { + int x = ev->globalPos().x(); + int y = ev->globalPos().y(); + + int dx = x - m_pos.x(); + int dy = y - m_pos.y(); + + if ((m_left || m_right) && qAbs(dx) < 5) + return; + if ((m_top || m_bottom) && qAbs(dy) < 5) + return; + if (m_left && dx > 0 && m_rect.width() <= m_frame->minimumWidth()) + return ; + if (m_top && dy > 0 && m_rect.height() <= m_frame->minimumHeight()) + return; + + QRect rc = m_rect; + if (m_left) + rc.setLeft(rc.left() + dx); + if (m_right) + rc.setRight(rc.right() + dx); + if (m_top) + rc.setTop(rc.top() + dy); + if (m_bottom) + rc.setBottom(rc.bottom() + dy); + + m_frame->setGeometry(rc); + m_rect = rc; + m_pos = ev->globalPos(); + } + else + { + int x = ev->x() + QSSDIALOG_SHADOW_WIDTH - 2; + int y = ev->y() + QSSDIALOG_SHADOW_WIDTH - 2; + + QRect rc = m_frame->rect(); + m_left = qAbs(x - rc.left()) <= 5; + m_right = qAbs(x - rc.right()) <= 5; + m_top = qAbs(y - rc.top()) <= 5; + m_bottom = qAbs(y - rc.bottom()) <= 5; + + if ((m_left && m_top) || (m_right && m_bottom)) + m_frame->setCursor(Qt::SizeFDiagCursor); + else if ((m_right && m_top) || (m_left && m_bottom)) + m_frame->setCursor(Qt::SizeBDiagCursor); + else if ((m_left && !m_top && !m_bottom) || (m_right && !m_top && !m_bottom)) + m_frame->setCursor(Qt::SizeHorCursor); + else if ((m_top && !m_right && !m_left) || (m_bottom && !m_right && !m_left)) + m_frame->setCursor(Qt::SizeVerCursor); + else + m_frame->setCursor(Qt::ArrowCursor); + } +} + +void QssDialog::onMousePressEvent( QMouseEvent * ev ) +{ + m_pos = ev->globalPos(); + m_rect = m_frame->geometry(); + if(m_left || m_right || m_top || m_bottom) + { + m_mousePressedInBorder = ev->button() == Qt::LeftButton; + //qDebug() << "mousePressed pressed in border"; + } +} + + +void QssDockWidget::onMousePressEvent( QMouseEvent * ev ) +{ + m_pos = ev->globalPos(); + m_rect = m_frame->geometry(); + if(m_left || m_right || m_top || m_bottom) + { + m_mousePressedInBorder = ev->button() == Qt::LeftButton; + //qDebug() << "mousePressed pressed in border"; + } +} + +void QssDialog::onMouseReleaseEvent( QMouseEvent * ev ) +{ + m_mousePressedInBorder = false; + //qDebug() << "mousePressed release in border"; +} + +void QssDockWidget::onMouseReleaseEvent( QMouseEvent * ev ) +{ + m_mousePressedInBorder = false; + //qDebug() << "mousePressed release in border"; +} + +bool QssDialog::eventFilter( QObject * obj, QEvent * ev ) +{ + if (obj == m_frame) + { + if (ev->type() == QEvent::MouseMove) + { + QMouseEvent * mouseEv = dynamic_cast(ev); + if (ev) + { + onMouseMoveEvent(mouseEv); + return true; + } + } + else if (ev->type() == QEvent::MouseButtonPress) + { + QMouseEvent * mouseEv = dynamic_cast(ev); + if (ev) + { + onMousePressEvent(mouseEv); + return true; + } + } + else if (ev->type() == QEvent::MouseButtonRelease) + { + QMouseEvent * mouseEv = dynamic_cast(ev); + if (ev) + { + onMouseReleaseEvent(mouseEv); + return true; + } + }/** */ + else if (ev->type() == QEvent::Paint) + { + const int shadowWidth = QSSDIALOG_SHADOW_WIDTH; + const int boderWidht = QSSDIALOG_BODER_WIDTH; + + QPainter paiter(m_frame); + + QColor colorBorder(0xaa,0xaa,0xaa); + paiter.setPen(colorBorder); + + int boderOffset = shadowWidth + boderWidht - 1; + paiter.drawLine(boderOffset,boderOffset,m_frame->width() - boderOffset - 1, boderOffset);//top + paiter.drawLine(boderOffset,m_frame->height() - boderOffset - 1,m_frame->width() - boderOffset - 1, m_frame->height() - boderOffset - 1);//bottom + + paiter.drawLine(boderOffset,boderOffset,boderOffset,m_frame->height() - boderOffset - 1);//left + paiter.drawLine(m_frame->width() - boderOffset - 1,boderOffset,m_frame->width() - boderOffset - 1,m_frame->height() - boderOffset - 1);//right + + QColor colorShadow(0xaa,0xaa,0xaa); + for (int i = 0; i < shadowWidth; i++) + { + colorShadow.setAlpha(100*cos(1.5707963*i/(shadowWidth - 1))); + paiter.setPen(colorShadow); + paiter.drawRect(boderOffset + i, boderOffset + i, + m_frame->width() - 2*shadowWidth , + m_frame->height() - 2*shadowWidth ); + } + } + else if (ev->type() == QEvent::Show) + { + QRect rc = m_frame->rect(), parentRc; + if (m_parent) + { + /** */ + QPoint pt = m_parent->mapToGlobal(QPoint(0,0)); + parentRc =m_parent->rect(); + parentRc.translate(pt); + } + else/** */ + parentRc = m_rcValid; + + /** m_frame */ + int x = parentRc.left() + (parentRc.width() - rc.width())*0.5;x = x <= 0?1:x; + int y = parentRc.top() + (parentRc.height() - rc.height())*0.5;y = y <= 0?1:y; + m_frame->move(x,y); + + /** */ + QPropertyAnimation* aniSize = new QPropertyAnimation(m_frame,"geometry"); + aniSize->setDuration(200); + aniSize->setKeyValueAt(0, QRect(x,y,0,0)); + aniSize->setKeyValueAt(0.5, QRect(x ,y,rc.width() + 20,rc.height() + 30)); + aniSize->setKeyValueAt(1 , QRect(x,y,rc.width(),rc.height())); + //aniSize->setEasingCurve(QEasingCurve::InOutBack);// + + QPropertyAnimation* aniOpacity = new QPropertyAnimation(m_frame,"windowOpacity"); + aniOpacity->setDuration(200); + aniOpacity->setStartValue(0); + aniOpacity->setEndValue(1); + + QParallelAnimationGroup* aniGroup = new QParallelAnimationGroup(m_frame); + aniGroup->addAnimation(aniSize); + aniGroup->addAnimation(aniOpacity); + + aniGroup->start(QAbstractAnimation::DeleteWhenStopped); + + } + else if (ev->type() == QEvent::Close) + { + close(); + } + } + else if (obj == m_titleBar) + { + if (ev->type() == QEvent::Enter) + { + m_left = false;m_right = false; m_top = false; m_bottom = false; + if (m_frame->cursor().shape() != Qt::ArrowCursor) + m_frame->setCursor(Qt::ArrowCursor); + } + } + else if (obj == this) + { + if (ev->type() == QEvent::Enter) + { + m_left = false;m_right = false; m_top = false; m_bottom = false; + if (m_frame->cursor().shape() != Qt::ArrowCursor) + m_frame->setCursor(Qt::ArrowCursor); + } + else if (ev->type() == QEvent::Hide) + { + m_frame->hide(); + return true; + } + } + + return QDialog::eventFilter(obj, ev); +} + +QssMessageBox::QssMessageBox( Icon icon, const QString &title, const QString &text, StandardButtons buttons /*= NoButton*/, QWidget *parent /*= 0*/, Qt::WindowFlags flags /*= Qt::Widget | Qt::FramelessWindowHint*/ ) +:QMessageBox(icon, title, text, buttons, 0, flags),m_parent(parent) +{ + m_rcValid = QApplication::desktop()->availableGeometry(); + + m_frame = new QFrame; + m_frame->setObjectName("messagebox");//css + m_frame->setAttribute(Qt::WA_TranslucentBackground);/** padding */ + m_frame->setWindowFlags(Qt::Dialog |Qt::FramelessWindowHint| Qt::WindowSystemMenuHint); + m_frame->setMouseTracking(true); + m_frame->installEventFilter(this); + + m_frame->setWindowTitle(title); + m_frame->setWindowIcon(style()->standardIcon((QStyle::StandardPixmap)(icon + 8))); + m_frame->setWindowModality(Qt::ApplicationModal); + + m_titleBar = new QssTtitleBar(m_frame, QssTtitleBar::QTitleBar_Type_MessageBox); + m_titleBar->installEventFilter(this); + + m_titleBar->setTitle(title); + m_titleBar->setIcon(style()->standardIcon((QStyle::StandardPixmap)(icon + 8))); + + QVBoxLayout* vbox = new QVBoxLayout(m_frame); + vbox->setMargin(0); + vbox->setSpacing(0); + vbox->addWidget(m_titleBar); + vbox->addWidget(this); + + installEventFilter(this); +} + +QssMessageBox::QssMessageBox( QWidget *parent /*= 0*/ ) +:QMessageBox(parent),m_parent(parent) +{ + m_rcValid = QApplication::desktop()->availableGeometry(); + + m_frame = new QFrame; + m_frame->setObjectName("messagebox");//css + m_frame->setAttribute(Qt::WA_TranslucentBackground);/** padding */ + m_frame->setWindowFlags(Qt::FramelessWindowHint| Qt::WindowSystemMenuHint); + m_frame->setMouseTracking(true); + m_frame->installEventFilter(this); + m_frame->setWindowModality(Qt::ApplicationModal); + + m_titleBar = new QssTtitleBar(m_frame, QssTtitleBar::QTitleBar_Type_MessageBox); + m_titleBar->installEventFilter(this); + + QVBoxLayout* vbox = new QVBoxLayout(m_frame); + vbox->setMargin(0); + vbox->setSpacing(0); + vbox->addWidget(m_titleBar); + vbox->addWidget(this); + + installEventFilter(this); +} + +QssMessageBox::~QssMessageBox() +{ + m_frame->deleteLater(); +} + +bool QssMessageBox::eventFilter( QObject * obj, QEvent * ev ) +{ + if (obj == m_frame) + { + if (ev->type() == QEvent::Paint) + { + const int shadowWidth = QSSDIALOG_SHADOW_WIDTH; + const int boderWidht = QSSDIALOG_BODER_WIDTH; + + QPainter paiter(m_frame); + + QColor colorBorder(0xaa,0xaa,0xaa); + paiter.setPen(colorBorder); + + int boderOffset = shadowWidth + boderWidht - 1; + paiter.drawLine(boderOffset,boderOffset,m_frame->width() - boderOffset - 1, boderOffset);//top + paiter.drawLine(boderOffset,m_frame->height() - boderOffset - 1,m_frame->width() - boderOffset - 1, m_frame->height() - boderOffset - 1);//bottom + + paiter.drawLine(boderOffset,boderOffset,boderOffset,m_frame->height() - boderOffset - 1);//left + paiter.drawLine(m_frame->width() - boderOffset - 1,boderOffset,m_frame->width() - boderOffset - 1,m_frame->height() - boderOffset - 1);//right + + QColor colorShadow(0xaa,0xaa,0xaa); + for (int i = 0; i < shadowWidth; i++) + { + colorShadow.setAlpha(100*cos(1.5707963*i/(shadowWidth - 1))); + paiter.setPen(colorShadow); + paiter.drawRect(boderOffset + i, boderOffset + i, + m_frame->width() - 2*shadowWidth , + m_frame->height() - 2*shadowWidth ); + } + } + else if (ev->type() == QEvent::Show) + { + QRect rc = m_frame->rect(), parentRc; + if (m_parent)/**�� */ + { + QPoint pt = m_parent->mapToGlobal(QPoint(0,0)); + parentRc =m_parent->rect(); + parentRc.translate(pt); + } + else/** */ + parentRc = m_rcValid; + /** m_frame */ + int x = parentRc.left() + (parentRc.width() - rc.width())*0.5;x = x <= 0?1:x; + int y = parentRc.top() + (parentRc.height() - rc.height())*0.5;y = y <= 0?1:y; + m_frame->move(x,y); + + /** */ + QPropertyAnimation* aniSize = new QPropertyAnimation(m_frame,"geometry"); + aniSize->setDuration(200); + aniSize->setKeyValueAt(0, QRect(x,y,0,0)); + aniSize->setKeyValueAt(0.5, QRect(x ,y,rc.width() + 10,rc.height() + 15)); + aniSize->setKeyValueAt(1 , QRect(x,y,rc.width(),rc.height())); + //aniSize->setEasingCurve(QEasingCurve::InOutBack);// + + QPropertyAnimation* aniOpacity = new QPropertyAnimation(m_frame,"windowOpacity"); + aniOpacity->setDuration(200); + aniOpacity->setStartValue(0); + aniOpacity->setEndValue(1); + + QParallelAnimationGroup* aniGroup = new QParallelAnimationGroup(m_frame); + aniGroup->addAnimation(aniSize); + aniGroup->addAnimation(aniOpacity); + + aniGroup->start(QAbstractAnimation::DeleteWhenStopped); + + } + else if (ev->type() == QEvent::Close) + { + close(); + m_titleBar->close(); + } + } + else if(obj == this) + { + if (ev->type() == QEvent::Resize) + { + /* QMessageBoxframe��framebug */ + frame()->setFixedWidth(size().width() + 2*QSSDIALOG_SHADOW_WIDTH); + } + } + + return QDialog::eventFilter(obj, ev); +} + +QMessageBox::StandardButton QssMessageBox::tips( const QString & text, QWidget* parent /*= 0*/, const QString & title /*= QString::fromLocal8Bit("")*/, StandardButtons btn /*= QMessageBox::Ok*/ ) +{ + QssMessageBox box(QMessageBox::Information, title, "\n" + text/* + "\n"*/, btn, parent); + box.setDefaultButton(QMessageBox::Ok); + + box.frame()->show(); + box.frame()->raise(); + box.frame()->activateWindow(); + + QMessageBox::StandardButton ret = (QMessageBox::StandardButton)box.exec(); + box.frame()->close(); + + return ret; +} + +QMessageBox::StandardButton QssMessageBox::warn( const QString & text, QWidget* parent /*= 0*/, const QString & title /*= QString::fromLocal8Bit("")*/, StandardButtons btn /*= QMessageBox::Ok*/ ) +{ + QssMessageBox box(QMessageBox::Warning, title, "\n" + text/* + "\n"*/ , btn, parent); + box.setDefaultButton(QMessageBox::Ok); + + box.frame()->show(); + box.frame()->raise(); + box.frame()->activateWindow(); + + QMessageBox::StandardButton ret = (QMessageBox::StandardButton)box.exec(); + box.frame()->close(); + + return ret; +} + +QMessageBox::StandardButton QssMessageBox::error( const QString & text, QWidget* parent /*= 0*/, const QString & title /*= QString::fromLocal8Bit("")*/, StandardButtons btn /*= QMessageBox::Ok*/ ) +{ + QssMessageBox box(QMessageBox::Critical, title, "\n" + text/* + "\n"*/, btn, parent); + box.setDefaultButton(QMessageBox::Ok); + + box.frame()->show(); + box.frame()->raise(); + box.frame()->activateWindow(); + + QMessageBox::StandardButton ret = (QMessageBox::StandardButton)box.exec(); + box.frame()->close(); + + return ret; +} + +QMessageBox::StandardButton QssMessageBox::ask( const QString & text, QWidget* parent /*= 0*/, const QString & title /*= QString::fromLocal8Bit("")*/, StandardButtons btn /*= QMessageBox::Yes | QMessageBox::No*/ ) +{ + QssMessageBox box(QMessageBox::Question, title, "\n" + text/* + "\n"*/, btn, parent); + box.setDefaultButton(QMessageBox::Yes); + + box.frame()->show(); + box.frame()->raise(); + box.frame()->activateWindow(); + + QMessageBox::StandardButton ret = (QMessageBox::StandardButton)box.exec(); + box.frame()->close(); + + return ret; +} + + +QMessageBox::StandardButton QssMessageBox::regard( const QString & text, QWidget* parent /*= 0*/, const QString & title /*= QString::fromLocal8Bit("")*/ ) +{ + QssMessageBox box(parent); + + QIcon icon = QApplication::windowIcon(); + QSize size = icon.actualSize(QSize(64, 64)); + box.setIconPixmap(icon.pixmap(size)); + box.setDefaultButton(QMessageBox::Ok); + + box.frame()->setWindowIcon(icon); + box.titleBar()->setIcon(icon); + + box.frame()->setWindowTitle(title); + box.titleBar()->setTitle(title); + + box.setInformativeText(text); + + box.frame()->show(); + box.frame()->raise(); + box.frame()->activateWindow(); + + QMessageBox::StandardButton ret = (QMessageBox::StandardButton)box.exec(); + box.frame()->close(); + + return ret; +} + +QMessageBox::StandardButton QssMessageBox::regard( const QString & text, QIcon icon, QWidget* parent /*= 0*/, const QString & title /*= QString::fromLocal8Bit("")*/ ) +{ + QssMessageBox box(parent); + QSize size = icon.actualSize(QSize(64, 64)); + box.setIconPixmap(icon.pixmap(size)); + box.setDefaultButton(QMessageBox::Ok); + + box.frame()->setWindowIcon(icon); + box.titleBar()->setIcon(icon); + + box.frame()->setWindowTitle(title); + box.titleBar()->setTitle(title); + + box.setInformativeText(text); + + box.frame()->show(); + box.frame()->raise(); + box.frame()->activateWindow(); + + QMessageBox::StandardButton ret = (QMessageBox::StandardButton)box.exec(); + box.frame()->close(); + + return ret; +} + +QMessageBox::StandardButton QssMessageBox::regardQt(QWidget* parent /*= 0*/, const QString & title /*= QString::fromLocal8Bit("Qt")*/ ) +{ + QString translatedTextAboutQtCaption; + translatedTextAboutQtCaption = QMessageBox::tr( + "

About Qt

" + "

This program uses Qt version %1.

" + ).arg(QLatin1String(QT_VERSION_STR)); + QString translatedTextAboutQtText; + translatedTextAboutQtText = QMessageBox::tr( + "

Qt is a C++ toolkit for cross-platform application " + "development.

" + "

Qt provides single-source portability across MS Windows, " + "Mac OS X, Linux, and all major commercial Unix variants. " + "Qt is also available for embedded devices as Qt for Embedded Linux " + "and Qt for Windows CE.

" + "

Qt is available under three different licensing options designed " + "to accommodate the needs of our various users.

" + "

Qt licensed under our commercial license agreement is appropriate " + "for development of proprietary/commercial software where you do not " + "want to share any source code with third parties or otherwise cannot " + "comply with the terms of the GNU LGPL version 2.1 or GNU GPL version " + "3.0.

" + "

Qt licensed under the GNU LGPL version 2.1 is appropriate for the " + "development of Qt applications (proprietary or open source) provided " + "you can comply with the terms and conditions of the GNU LGPL version " + "2.1.

" + "

Qt licensed under the GNU General Public License version 3.0 is " + "appropriate for the development of Qt applications where you wish to " + "use such applications in combination with software subject to the " + "terms of the GNU GPL version 3.0 or where you are otherwise willing " + "to comply with the terms of the GNU GPL version 3.0.

" + "

Please see qt.nokia.com/products/licensing " + "for an overview of Qt licensing.

" + "

Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).

" + "

Qt is a Nokia product. See qt.nokia.com " + "for more information.

" + ); + + QPixmap pm(QMessageBox::tr(":/trolltech/qmessagebox/images/qtlogo-64.png")); + + QssMessageBox box(parent); + box.setWindowTitle(title.isEmpty() ? QString::fromLocal8Bit("Qt") : title); + box.setText(translatedTextAboutQtCaption); + box.setInformativeText(translatedTextAboutQtText); + if (!pm.isNull()) + box.setIconPixmap(pm); + box.setDefaultButton(QMessageBox::Ok); + + box.frame()->setWindowIcon(QIcon(":/trolltech/qmessagebox/images/qtlogo-64.png")); + box.frame()->setWindowTitle(title.isEmpty() ? QString::fromLocal8Bit("Qt") : title); + box.titleBar()->setIcon(QIcon(":/trolltech/qmessagebox/images/qtlogo-64.png")); + box.titleBar()->setTitle(title.isEmpty() ? QString::fromLocal8Bit("Qt") : title); + + box.frame()->show(); + box.frame()->raise(); + box.frame()->activateWindow(); + + QMessageBox::StandardButton ret = (QMessageBox::StandardButton)box.exec(); + box.frame()->close(); + + return ret; +} + + +QMessageBox::StandardButton QssMessageBox::information( QWidget *parent, const QString &title, const QString &text, StandardButtons buttons /*= Ok*/, StandardButton defaultButton /*= NoButton*/ ) +{ + return QssMessageBox::tips(text, parent, title, buttons); +} + +QMessageBox::StandardButton QssMessageBox::question( QWidget *parent, const QString &title, const QString &text, StandardButtons buttons /*= QMessageBox::Ok*/, StandardButton defaultButton /*= QMessageBox::NoButton*/ ) +{ + return QssMessageBox::ask(text, parent, title, buttons); +} + +QMessageBox::StandardButton QssMessageBox::warning( QWidget *parent, const QString &title, const QString &text, StandardButtons buttons /*= QMessageBox::Ok*/, StandardButton defaultButton /*= QMessageBox::NoButton*/ ) +{ + return QssMessageBox::warn(text, parent, title, buttons); +} + +QMessageBox::StandardButton QssMessageBox::critical( QWidget *parent, const QString &title, const QString &text, StandardButtons buttons /*= QMessageBox::Ok*/, StandardButton defaultButton /*= QMessageBox::NoButton*/ ) +{ + return QssMessageBox::error(text, parent, title, buttons); +} + +void QssMessageBox::about( QWidget *parent, const QString &title, const QString &text ) +{ + QssMessageBox::regard(text, parent, title); +} + +void QssMessageBox::about( QWidget *parent, const QString &title, const QString &text, QIcon icon ) +{ + QssMessageBox::regard(text, icon, parent, title); +} + +void QssMessageBox::aboutQt( QWidget *parent, const QString &title /*= QString()*/ ) +{ + QssMessageBox::regardQt(parent, title); +} + + +QssDockWidget::QssDockWidget(QWidget *parent) + : QDockWidget(parent), + m_mousePressedInBorder(false), + m_parent(parent) +{ + m_rcValid = QApplication::desktop()->availableGeometry(); + + m_frame = new QFrame(parent); + m_frame->setObjectName("dialog");//css + m_frame->setAttribute(Qt::WA_TranslucentBackground);/** padding css boder��*/ + m_frame->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint/* | Qt::WindowMinimizeButtonHint*/);//Qt::WindowMinimizeButtonHintdialog�� + m_frame->setMouseTracking(true); + m_frame->installEventFilter(this); + + m_titleBar = new QssTtitleBar(m_frame, QssTtitleBar::QTitleBar_Type_Dialog); + m_titleBar->installEventFilter(this); + + QVBoxLayout* vbox = new QVBoxLayout(m_frame); + vbox->setMargin(0); + vbox->setSpacing(0); + vbox->addWidget(m_titleBar); + vbox->addWidget(this); + + installEventFilter(this); + this->setStyleSheet(QString("{background: rgb(232, 241, 252);""color: black;border: 1px solid rgb(111, 156, 207);}")); +} + +QssDockWidget::~QssDockWidget() +{ + m_frame->deleteLater(); +} + +void QssDockWidget::setWindowTitle(QString title) +{ + m_frame->setWindowTitle(title); + m_titleBar->setTitle(title); +} + +bool QssDockWidget::eventFilter(QObject *obj, QEvent *ev) +{ + if (obj == m_frame) + { + if (ev->type() == QEvent::MouseMove) + { + QMouseEvent * mouseEv = dynamic_cast(ev); + if (ev) + { + onMouseMoveEvent(mouseEv); + return true; + } + } + else if (ev->type() == QEvent::MouseButtonPress) + { + QMouseEvent * mouseEv = dynamic_cast(ev); + if (ev) + { + onMousePressEvent(mouseEv); + return true; + } + } + else if (ev->type() == QEvent::MouseButtonRelease) + { + QMouseEvent * mouseEv = dynamic_cast(ev); + if (ev) + { + onMouseReleaseEvent(mouseEv); + return true; + } + }/** */ + else if (ev->type() == QEvent::Paint) + { + const int shadowWidth = QSSDIALOG_SHADOW_WIDTH; + const int boderWidht = QSSDIALOG_BODER_WIDTH; + + QPainter paiter(m_frame); + + QColor colorBorder(0xaa,0xaa,0xaa); + paiter.setPen(colorBorder); + + int boderOffset = shadowWidth + boderWidht - 1; + paiter.drawLine(boderOffset,boderOffset,m_frame->width() - boderOffset - 1, boderOffset);//top + paiter.drawLine(boderOffset,m_frame->height() - boderOffset - 1,m_frame->width() - boderOffset - 1, m_frame->height() - boderOffset - 1);//bottom + + paiter.drawLine(boderOffset,boderOffset,boderOffset,m_frame->height() - boderOffset - 1);//left + paiter.drawLine(m_frame->width() - boderOffset - 1,boderOffset,m_frame->width() - boderOffset - 1,m_frame->height() - boderOffset - 1);//right + + QColor colorShadow(0xaa,0xaa,0xaa); + for (int i = 0; i < shadowWidth; i++) + { + colorShadow.setAlpha(100*cos(1.5707963*i/(shadowWidth - 1))); + paiter.setPen(colorShadow); + paiter.drawRect(boderOffset + i, boderOffset + i, + m_frame->width() - 2*shadowWidth , + m_frame->height() - 2*shadowWidth ); + } + } + else if (ev->type() == QEvent::Show) + { + QRect rc = m_frame->rect(), parentRc; + if (m_parent)/**�� */ + { + /** */ + QPoint pt = m_parent->mapToGlobal(QPoint(0,0)); + parentRc =m_parent->rect(); + parentRc.translate(pt); + } + else/** */ + parentRc = m_rcValid; + + /** m_frame */ + int x = parentRc.left() + (parentRc.width() - rc.width())*0.5;x = x <= 0?1:x; + int y = parentRc.top() + (parentRc.height() - rc.height())*0.5;y = y <= 0?1:y; + m_frame->move(x,y); + + /** */ + QPropertyAnimation* aniSize = new QPropertyAnimation(m_frame,"geometry"); + aniSize->setDuration(200); + aniSize->setKeyValueAt(0, QRect(x,y,0,0)); + aniSize->setKeyValueAt(0.5, QRect(x ,y,rc.width() + 20,rc.height() + 30)); + aniSize->setKeyValueAt(1 , QRect(x,y,rc.width(),rc.height())); + //aniSize->setEasingCurve(QEasingCurve::InOutBack);// + + QPropertyAnimation* aniOpacity = new QPropertyAnimation(m_frame,"windowOpacity"); + aniOpacity->setDuration(200); + aniOpacity->setStartValue(0); + aniOpacity->setEndValue(1); + + QParallelAnimationGroup* aniGroup = new QParallelAnimationGroup(m_frame); + aniGroup->addAnimation(aniSize); + aniGroup->addAnimation(aniOpacity); + + /** �� */ + aniGroup->start(QAbstractAnimation::DeleteWhenStopped); + + } + else if (ev->type() == QEvent::Close) + { + close(); + } + } + else if (obj == m_titleBar) + { + if (ev->type() == QEvent::Enter) + { + m_left = false;m_right = false; m_top = false; m_bottom = false; + if (m_frame->cursor().shape() != Qt::ArrowCursor) + m_frame->setCursor(Qt::ArrowCursor); + } + } + else if (obj == this) + { + if (ev->type() == QEvent::Enter) + { + m_left = false;m_right = false; m_top = false; m_bottom = false; + if (m_frame->cursor().shape() != Qt::ArrowCursor) + m_frame->setCursor(Qt::ArrowCursor); + } + else if (ev->type() == QEvent::Hide) + { + m_frame->hide(); + return true; + } + } + + return QDockWidget::eventFilter(obj, ev); +} + +QssPushButton::QssPushButton(QWidget *parent, QString objName): + QPushButton(parent) +{ + this->setObjectName(objName); + +} diff --git a/Qss.h b/Qss.h new file mode 100644 index 0000000..1139654 --- /dev/null +++ b/Qss.h @@ -0,0 +1,296 @@ +/** +* @file: QssTtitleBar.h +* @details: css控件定制头文件,包括所有UI控件及自定义标题栏的主窗口,对话框及消息框 +* @author: chenwen(chenwen1126@tom.com) +* @datetime: 2017-7-25 +* @history: v1.0 first edition +*/ +#ifndef QSS_H +#define QSS_H + +#include +#include +#include +#include +#include +#include +#include + +class QPushButton; +class QLabel; +class QMouseEvent; + +class QssPushButton : public QPushButton{ +public: + QssPushButton(QWidget *parent,QString objName); + +}; + +class QssTtitleBar : public QWidget +{ + Q_OBJECT + +public: + enum QTitleBar_Button + { + QTitleBar_Button_Min = 0x00000001, + QTitleBar_Button_Max = 0x00000002, + QTitleBar_Button_Restore = 0x00000004, + QTitleBar_Button_Close = 0x00000008 + }; + + enum QTitleBar_Type + { + QTitleBar_Type_MainWindow = QTitleBar_Button_Min | QTitleBar_Button_Max | QTitleBar_Button_Restore | QTitleBar_Button_Close, + QTitleBar_Type_Dialog = QTitleBar_Button_Close, + QTitleBar_Type_MessageBox = QTitleBar_Button_Close + }; + + QssTtitleBar(QWidget *parent, QTitleBar_Type type = QTitleBar_Type_MainWindow); + ~QssTtitleBar(); + + void setTitle(QString title); + void setIcon( QIcon icon); + + void setMaxOrRestore(bool val); + bool maxOrRestore(){return m_maxOrRestore;} + void SetMainWindow(QMainWindow*); + QRect& normalRect(){return m_rcNormal;} + +private slots: + void onMaxOrRestore(); + +protected: + void paintEvent(QPaintEvent *); + void mouseMoveEvent(QMouseEvent * ev); + void mousePressEvent(QMouseEvent * ev); + void mouseReleaseEvent(QMouseEvent * ev); + + bool eventFilter(QObject * obj, QEvent * ev); + +private: + QPushButton* m_closeBtn; + QPushButton* m_maxBtn; + QPushButton* m_restoreBtn; + QPushButton* m_minBtn; + QPushButton* m_iconBtn; + + QLabel* m_titlebarTitle; + QMainWindow *m_Main; + bool m_maxOrRestore; + bool m_pressed; + + QPoint m_pressedPos; + + QRect m_rcValid;//桌面最大可用尺寸 + QRect m_rcNormal;//还原后窗口尺寸 + + QTitleBar_Type m_type; +}; + +class QssMainWindow : public QMainWindow +{ + Q_OBJECT + +public: + QssMainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0); + virtual ~QssMainWindow(); + + void show(); + void showMinimized(); + void showMaximized(); + void showFullScreen(); + void showNormal(); + void setCursorShape(int CalPos) ; + void setWindowTitle( QString title ); + void setWindowIcon( QIcon icon ); + int CalCursorPos(QPoint pt, int colPos); + + inline QssTtitleBar* titleBar(){return m_titleBar;} + inline QFrame* frame(){return m_frame;} + int CalCursorCol(QPoint pt); //计算鼠标X的位置 + + virtual bool eventFilter(QObject * obj, QEvent * ev); + +private: + void onMouseMoveEvent(QMouseEvent * ev); + void onMousePressEvent(QMouseEvent * ev); + void onMouseReleaseEvent(QMouseEvent * ev); + +private: + QFrame* m_frame; + QssTtitleBar* m_titleBar; + + QRect m_rcValid;//桌面最大可用尺寸 + QRect m_rcNormal;//还原后窗口尺寸 + + /** 边框调整大小相关 */ + QRect m_rect; + QRect m_CentralRect; + QPoint m_pos; + bool m_mousePressedInBoundy; + bool m_left,m_right,m_top,m_bottom; + + + int m_iCalCursorPos; + bool m_bLeftPress; + QRect m_rtPreGeometry; + QPoint m_ptViewMousePos; +}; + +class QssDialog : public QDialog +{ + Q_OBJECT + +public: + QssDialog(QWidget *parent); + virtual ~QssDialog(); + + void show(); + void raise(); + void activateWindow(); + + int exec(); + + void setWindowTitle( QString title ); + void setWindowIcon( QIcon icon ); + + inline QssTtitleBar* titleBar(){return m_titleBar;} + inline QFrame* frame(){return m_frame;} + + virtual bool eventFilter(QObject * obj, QEvent * ev); + +private: + void onMouseMoveEvent(QMouseEvent * ev); + void onMousePressEvent(QMouseEvent * ev); + void onMouseReleaseEvent(QMouseEvent * ev); + +private: + QFrame* m_frame; + QssTtitleBar* m_titleBar; + + QRect m_rcValid; + QWidget* m_parent; + + /** 边框调整大小相关 */ + QRect m_rect; + QPoint m_pos; + bool m_mousePressedInBorder; + bool m_left,m_right,m_top,m_bottom; + +}; + + +// 可停靠widget +class QssDockWidget : public QDockWidget +{ + Q_OBJECT + +public: + QssDockWidget(QWidget *parent); + virtual ~QssDockWidget(); + + void show(); + void raise(); + void activateWindow(); + + int exec(); + + void setWindowTitle( QString title ); + void setWindowIcon( QIcon icon ); + void paintEvent(QPaintEvent *); + inline QssTtitleBar* titleBar(){return m_titleBar;} + inline QFrame* frame(){return m_frame;} + + virtual bool eventFilter(QObject * obj, QEvent * ev); + +private: + void onMouseMoveEvent(QMouseEvent * ev); + void onMousePressEvent(QMouseEvent * ev); + void onMouseReleaseEvent(QMouseEvent * ev); + +private: + QFrame* m_frame; + QssTtitleBar* m_titleBar; + + QRect m_rcValid; + QWidget* m_parent; + + /** 边框调整大小相关 */ + QRect m_rect; + QPoint m_pos; + bool m_mousePressedInBorder; + bool m_left,m_right,m_top,m_bottom; + +}; + +class QssMessageBox : public QMessageBox +{ + Q_OBJECT + +public: + explicit QssMessageBox(QWidget *parent = 0); + QssMessageBox(Icon icon, const QString &title, const QString &text, + StandardButtons buttons = NoButton, QWidget *parent = 0, + Qt::WindowFlags flags = Qt::Widget | Qt::FramelessWindowHint); + ~QssMessageBox(); + + inline QssTtitleBar* titleBar(){return m_titleBar;} + inline QFrame* frame(){return m_frame;} + + /** 配合宏使用,更为简洁 */ + static QMessageBox::StandardButton tips(const QString & text, QWidget* parent = 0, + const QString & title = QString::fromLocal8Bit("提示"), StandardButtons btn = QMessageBox::Ok); + static QMessageBox::StandardButton warn(const QString & text, QWidget* parent = 0, + const QString & title = QString::fromLocal8Bit("警告"), StandardButtons btn = QMessageBox::Ok); + static QMessageBox::StandardButton error(const QString & text, QWidget* parent = 0, + const QString & title = QString::fromLocal8Bit("错误"), StandardButtons btn = QMessageBox::Ok); + static QMessageBox::StandardButton ask(const QString & text, QWidget* parent = 0, + const QString & title = QString::fromLocal8Bit("询问"), StandardButtons btn = QMessageBox::Yes | QMessageBox::No); + + /** 覆盖定义,适配原有QMessageBox */ + static StandardButton information(QWidget *parent, const QString &title, + const QString &text, StandardButtons buttons = Ok, + StandardButton defaultButton = NoButton); + static StandardButton question(QWidget *parent, const QString &title, + const QString &text, StandardButtons buttons = QMessageBox::Ok, + StandardButton defaultButton = QMessageBox::NoButton); + static StandardButton warning(QWidget *parent, const QString &title, + const QString &text, StandardButtons buttons = QMessageBox::Ok, + StandardButton defaultButton = QMessageBox::NoButton); + static StandardButton critical(QWidget *parent, const QString &title, + const QString &text, StandardButtons buttons = QMessageBox::Ok, + StandardButton defaultButton = QMessageBox::NoButton); + + static QMessageBox::StandardButton regard(const QString & text, QWidget* parent = 0, + const QString & title = QString::fromLocal8Bit("关于")); + static QMessageBox::StandardButton regard(const QString & text, QIcon icon, QWidget* parent = 0, + const QString & title = QString::fromLocal8Bit("关于")); + + static QMessageBox::StandardButton regardQt(QWidget* parent = 0, + const QString & title = QString::fromLocal8Bit("关于Qt")); + + static void about(QWidget *parent, const QString &title, const QString &text); + static void about(QWidget *parent, const QString &title, const QString &text, QIcon icon); + + static void aboutQt(QWidget *parent, const QString &title = QString()); + + bool eventFilter(QObject * obj, QEvent * ev); + +private: + QFrame* m_frame; + QssTtitleBar* m_titleBar; + QWidget* m_parent; + + QRect m_rcValid; +}; + +#define tipBox(text) QssMessageBox::tips(text) +#define warnBox(text) QssMessageBox::warn(text) +#define errBox(text) QssMessageBox::error(text) +#define askBox(text) QssMessageBox::ask(text) + +#define aboutBox(title, text) QssMessageBox::regard(text, 0,title) +#define aboutQtBox() QssMessageBox::regardQt() + +#endif // QSS_H diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 5b9b6c5..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# qsswraper - -#### Description -qt widget基于 qss的美化界面库,基本上重写了mainwindow,DialogDockWidget,MessageBox等界面,提供了统一的界面风格 - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index 1be730f..8d7b17e 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,5 @@ # qsswraper #### 介绍 -qt widget基于 qss的美化界面库,基本上重写了mainwindow,DialogDockWidget,MessageBox等界面,提供了统一的界面风格 -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +qt widget 基于 qss 的美化界面库,基本上重写了 mainwindow,DialogDockWidget,MessageBox 等界面,提供了统一的界面风格 diff --git a/css/dark.css b/css/dark.css new file mode 100644 index 0000000..c7021da --- /dev/null +++ b/css/dark.css @@ -0,0 +1,866 @@ +/* +Colour scheme used: +- White (text): #eff0f1 +- Dark black (main bg): #272a2d +- Lighter dark black (menu bar): #373b3f +- Dark blue: #18465d +- Gray: #76797C +- Red (accents): #db1c49 + +Useful reference on QSS: + - http://doc.qt.io/qt-5/stylesheet-reference.html#alternate-background-color-prop + +Be sure to change all image urls to the appropriate folder on your system. +*/ + + +QPushButton#btn_serial:enabled { + border-image: url(:/qss/icon/btn_serial.png); + background: rgb(120, 170, 220); + color: white; + margin-left: 10; + margin-top:5; +} +QPushButton#btn_serial:!enabled { + background: rgb(180, 180, 180); + color: white; +} + +QPushButton#btn_serial:enabled:hover{ + background: rgb(100, 160, 220); +} +QPushButton#btn_serial:enabled:pressed{ + background: rgb(0, 78, 161); +} + + +QPushButton#btn_process:enabled { + background: rgb(120, 170, 220); + color: white; + margin-left: 5; + margin-top:5; +} +QPushButton#btn_process:!enabled { + background: rgb(180, 180, 180); + color: white; +} +QPushButton#btn_process:enabled:hover{ + background: rgb(100, 160, 220); +} +QPushButton#btn_process:enabled:pressed{ + background: rgb(0, 78, 161); +} + +/*================================================================ +QWidget +================================================================*/ +QWidget { + color: #eff0f1; + background-color: #272a2d; + selection-background-color: #db1c49; + selection-color: #eff0f1; +} + +QWidget::item:hover { + background-color: #18465d; + color: #eff0f1; +} + +QWidget::item:selected { + background-color: #18465d; +} + +/*================================================================ +QCheckBox/QGroupBox +================================================================*/ +QCheckBox { + spacing: 5px; + outline: none; + color: #eff0f1; + margin-bottom: 2px; +} + +QCheckBox:disabled { + color: #76797C; +} + +QCheckBox::indicator, +QGroupBox::indicator { + width: 18px; + height: 18px; +} + +QGroupBox::indicator { + margin-left: 2px; +} + +QCheckBox::indicator:unchecked { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/checkbox_unchecked.png); +} + +QCheckBox::indicator:unchecked:hover, +QCheckBox::indicator:unchecked:focus, +QCheckBox::indicator:unchecked:pressed, +QGroupBox::indicator:unchecked:hover, +QGroupBox::indicator:unchecked:focus, +QGroupBox::indicator:unchecked:pressed { + border: none; + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/checkbox_unchecked_focus.png); +} + +QCheckBox::indicator:checked { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/checkbox_checked.png); +} + +QCheckBox::indicator:checked:hover, +QCheckBox::indicator:checked:focus, +QCheckBox::indicator:checked:pressed, +QGroupBox::indicator:checked:hover, +QGroupBox::indicator:checked:focus, +QGroupBox::indicator:checked:pressed { + border: none; + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/checkbox_checked_focus.png); +} + +QCheckBox::indicator:indeterminate { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/checkbox_indeterminate.png); +} + +QCheckBox::indicator:indeterminate:focus, +QCheckBox::indicator:indeterminate:hover, +QCheckBox::indicator:indeterminate:pressed { + image: url(C:/Users/franc/AppData/Roaming/TeXstudio/rc/checkbox_indeterminate_focus.png); +} + +QCheckBox::indicator:checked:disabled, +QGroupBox::indicator:checked:disabled { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/checkbox_checked_disabled.png); +} + +QCheckBox::indicator:unchecked:disabled, +QGroupBox::indicator:unchecked:disabled { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/checkbox_unchecked_disabled.png); +} + +/*================================================================ +QMenuBar - e.g. Main toolbar (file/edit/idefix etc.) +================================================================*/ +QMenuBar { + color: #eff0f1; + background-color: #373b3f; +} + +QMenuBar::item { + background: transparent; +} + +/*================================================================ +QMenu +================================================================*/ +QMenu { + border: 1px solid #76797C; + color: #eff0f1; + margin: 2px; +} + +QMenu::separator { + height: 2px; + background: #76797C; + margin-left: 5px; + margin-right: 5px; +} + +/*================================================================ +QToolbar +================================================================*/ +QToolBar { + border: 1px solid #393838; + background: 1px solid #272a2d; + font-weight: bold; +} + +QToolBar::handle:horizontal { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/Hmovetoolbar.png); +} + +QToolBar::handle:vertical { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/Vmovetoolbar.png); +} + +QToolBar::separator:horizontal { + width: 2px; + margin: 3px 10px; + background-color: #76797C; +} + +QToolBar::separator:vertical { + height: 2px; + margin: 10px 3px; + background-color: #76797C; +} + +/*================================================================ +QScrollBar - e.g. Scrollbar in internal PDFviewer, editor window etc. +================================================================*/ +QScrollBar:horizontal { + height: 25px; + margin: 3px 27px 3px 27px; + border: 1px transparent #2A2929; + border-radius: 4px; + background-color: #000000; +} + +QScrollBar::handle:horizontal { + background-color: #76797C; + min-width: 15px; + border-radius: 4px; +} + +QScrollBar::add-line:horizontal { + margin: 0px 3px 0px 3px; + border-image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/right_arrow_disabled.png); + width: 20px; + height: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} + +QScrollBar::sub-line:horizontal { + margin: 0px 3px 0px 3px; + border-image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/left_arrow_disabled.png); + height: 20px; + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} + +QScrollBar::add-line:horizontal:hover, +QScrollBar::add-line:horizontal:on { + border-image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/right_arrow.png); + height: 20px; + width: 20px; + subcontrol-position: right; + subcontrol-origin: margin; +} + +QScrollBar::sub-line:horizontal:hover, +QScrollBar::sub-line:horizontal:on { + border-image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/left_arrow.png); + height: 20px; + width: 20px; + subcontrol-position: left; + subcontrol-origin: margin; +} + +QScrollBar::up-arrow:horizontal, +QScrollBar::down-arrow:horizontal { + background: none; +} + +QScrollBar::add-page:horizontal, +QScrollBar::sub-page:horizontal { + background: none; +} + +QScrollBar:vertical { + background-color: #000000; + width: 25px; + margin: 27px 3px 27px 3px; + border: 1px solid #2A2929; + border-radius: 4px; +} + +QScrollBar::handle:vertical { + background-color: #76797C; + min-height: 15px; + border-radius: 4px; +} + +QScrollBar::sub-line:vertical { + margin: 3px 0px 3px 0px; + border-image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/up_arrow_disabled.png); + height: 20px; + width: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} + +QScrollBar::add-line:vertical { + margin: 3px 0px 3px 0px; + border-image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/down_arrow_disabled.png); + height: 20px; + width: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} + +QScrollBar::sub-line:vertical:hover, +QScrollBar::sub-line:vertical:on { + border-image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/up_arrow.png); + height: 20px; + width: 20px; + subcontrol-position: top; + subcontrol-origin: margin; +} + +QScrollBar::add-line:vertical:hover, +QScrollBar::add-line:vertical:on { + border-image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/down_arrow.png); + height: 20px; + width: 20px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} + +QScrollBar::up-arrow:vertical, +QScrollBar::down-arrow:vertical { + background: none; +} + +QScrollBar::add-page:vertical, +QScrollBar::sub-page:vertical { + background: none; +} + +/*================================================================ +QTabBar - e.g. File tabs (top), Bottom panel tabs (top), Autocompleter window tabs (bottom) +================================================================*/ +QTabBar { + qproperty-drawBase: 0; /* important */ + background-color: transparent; +} + +/* Workaround for QTabBars created from docked QDockWidgets which don't draw the border if not set and reseted as follows: */ +QTabBar { + border-top: 1px transparent #76797C; /* set color for all QTabBars */ +} +QDialog QTabBar { + border-color: transparent; /* set color for QTabBars inside Preferences dialog */ +} +/* */ + +QTabBar::close-button { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/close.png); + background: transparent; + margin-top: 6px; + margin-bottom: 6px; +} + +QTabBar::close-button:hover { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/close-hover.png); + background: transparent; + margin-top: 6px; + margin-bottom: 6px; +} + +QTabBar::close-button:pressed { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/close-pressed.png); + background: transparent; + margin-top: 6px; + margin-bottom: 6px; +} + +/* TOP TABS */ + +QTabBar::tab:top { + color: #eff0f1; + border: 1px solid #76797C; + border-bottom: 1px transparent black; + background-color: #31363b; + padding: 5px; + min-width: 50px; + border-top-left-radius: 6px; + border-top-right-radius: 6px; +} + +QTabBar::tab:top:selected { + color: #eff0f1; + background-color: #54575B; + border: 2px solid #76797C; + border-bottom: 3px solid #3daee9; + border-top-left-radius: 6px; + border-top-right-radius: 6px; +} + +QTabBar::tab:top:!selected:hover { + background-color: #18465d; +} + +/* BOTTOM TABS */ + +QTabBar::tab:bottom { + color: #eff0f1; + border: 1px solid #76797C; + border-top: 1px transparent black; + background-color: #31363b; + padding: 5px; + border-bottom-left-radius: 6px; + border-bottom-right-radius: 6px; + min-width: 50px; +} + +QTabBar::tab:bottom:selected { + color: #eff0f1; + background-color: #54575B; + border: 2px solid #76797C; + border-top: 3px solid #3daee9; + border-bottom-left-radius: 6px; + border-bottom-right-radius: 6px; +} + +QTabBar::tab:bottom:!selected:hover { + background-color: #18465d; +} + +/*================================================================ +QDockWidget - e.g. "Search" header in internal PDF viewer +================================================================*/ +QDockWidget { + titlebar-close-icon: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/transparent.png); + titlebar-normal-icon: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/transparent.png); +} + +QDockWidget::title { + background: #373b3f; + color: transparent; + border: 1px transparent; + text-align: left; +} + +QDockWidget::close-button, +QDockWidget::float-button { + border: transparent; + padding: 0px; + icon-size: 25px; + background: transparent; +} + +QDockWidget::float-button { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/undock.png); + subcontrol-position: right center; + left: -50px; +} + +QDockWidget::close-button { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/close.png); + subcontrol-position: right center; + left: -10px; +} + +QDockWidget::float-button:hover { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/undock-pressed.png); + subcontrol-position: right center; + left: -50px; +} + +QDockWidget::close-button:hover { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/close-pressed.png); + subcontrol-position: right center; + left: -10px; +} + +QDockWidget::close-button:pressed { + padding: 2px -2px -2px 2px; + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/close-pressed.png); +} + +QDockWidget::float-button:pressed { + padding: 2px -2px -2px 2px; + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/undock-pressed.png); +} + +QDockWidget QListView { + outline: 0; + background: #272a2d; + alternate-background-color: #373b3f; + color: #eff0f1; +} + +/*================================================================ +QTreeView, QListView +================================================================*/ +QTreeView, +QListView { + border: 1px solid #76797C; + background-color: #232629; +} + +QTreeView:branch:selected, +QTreeView:branch:hover { + background: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/transparent.png); +} + +QTreeView::branch:has-siblings:!adjoins-item { + border-image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/transparent.png); +} + +QTreeView::branch:has-siblings:adjoins-item { + border-image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/transparent.png); +} + +QTreeView::branch:!has-children:!has-siblings:adjoins-item { + border-image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/transparent.png); +} + +QTreeView::branch:has-children:!has-siblings:closed, +QTreeView::branch:closed:has-children:has-siblings { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/branch_closed.png); +} + +QTreeView::branch:open:has-children:!has-siblings, +QTreeView::branch:open:has-children:has-siblings { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/branch_open.png); +} + +QTreeView::branch:has-children:!has-siblings:closed:hover, +QTreeView::branch:closed:has-children:has-siblings:hover { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/branch_closed-on.png); +} + +QTreeView::branch:open:has-children:!has-siblings:hover, +QTreeView::branch:open:has-children:has-siblings:hover { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/branch_open-on.png); +} + +QListView::item:!selected:hover, +QTreeView::item:!selected:hover { + background: #18465d; + outline: 0; + color: #eff0f1; +} + +QListView::item:selected:hover, +QTreeView::item:selected:hover { + background: #287399; + color: #eff0f1; +} + +QTreeView::indicator:checked, +QListView::indicator:checked { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/checkbox_checked.png); +} + +QTreeView::indicator:unchecked, +QListView::indicator:unchecked { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/checkbox_unchecked.png); +} + +QTreeView::indicator:checked:hover, +QTreeView::indicator:checked:focus, +QTreeView::indicator:checked:pressed, +QListView::indicator:checked:hover, +QListView::indicator:checked:focus, +QListView::indicator:checked:pressed { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/checkbox_checked_focus.png); +} + +QTreeView::indicator:unchecked:hover, +QTreeView::indicator:unchecked:focus, +QTreeView::indicator:unchecked:pressed, +QListView::indicator:unchecked:hover, +QListView::indicator:unchecked:focus, +QListView::indicator:unchecked:pressed { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/checkbox_unchecked_focus.png); +} + +/*================================================================ +QPushButton +================================================================*/ +QPushButton { + color: #eff0f1; + background-color: #31363b; + border-width: 1px; + border-color: #76797C; + border-style: solid; + padding: 5px; + border-radius: 2px; + outline: none; +} + +QPushButton:disabled { + background-color: #31363b; + border-width: 1px; + border-color: #454545; + border-style: solid; + padding-top: 5px; + padding-bottom: 5px; + padding-left: 10px; + padding-right: 10px; + border-radius: 2px; + color: #454545; +} + +QPushButton:hover, +QPushButton:focus { + background-color: #18465d; + color: #ffffff; +} + +QPushButton:pressed { + background-color: #18465d; + padding-top: -15px; + padding-bottom: -17px; +} + +QPushButton:checked { + background-color: #76797C; + border-color: #6A6969; +} + +/*================================================================ +QToolButton - e.g. Reset pushbutton in GUI scaling, toolbar buttons +================================================================*/ +QToolButton { + text-align: center; +} + +/*================================================================ +QComboBox +================================================================*/ +QComboBox { + selection-background-color: #db1c49; + border: 1px solid #76797C; + border-radius: 2px; + padding: 5px; + min-width: 75px; +} + +QComboBox:hover, +QPushButton:hover, +QAbstractSpinBox:hover, +QLineEdit:hover, +QTextEdit:hover, +QPlainTextEdit:hover, +QAbstractView:hover, +QTreeView:hover { + border: 1px solid #3daee9; + color: #eff0f1; +} + +QComboBox:on { + padding-top: 3px; + padding-left: 4px; + selection-background-color: #4a4a4a; +} + +QComboBox QAbstractItemView { + background-color: #232629; + border-radius: 2px; + border: 1px solid #76797C; + selection-background-color: #18465d; +} + +QComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; + width: 35px; + border-left-width: 0px; + border-left-color: darkgray; + border-left-style: solid; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} + +QComboBox::down-arrow { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/down_arrow_disabled.png); +} + +QComboBox::down-arrow:on, +QComboBox::down-arrow:hover, +QComboBox::down-arrow:focus { + image: url(C:/Users/user/AppData/Roaming/TeXstudio/rc/down_arrow.png); +} + +/*================================================================ +QLineEdit - e.g. Search textbox in internal pdf viewer +================================================================*/ +QLineEdit { + selection-background-color: #db1c49; + border: 1px solid #76797C; +} + +/*================================================================ +QHeaderView +================================================================*/ +QHeaderView { + background-color: #31363b; + border: 1px transparent; + border-radius: 0px; + margin: 0px; + padding: 0px; +} + +QHeaderView::section { + background-color: #31363b; + color: #eff0f1; + padding: 5px; + border: 1px solid #76797C; + border-radius: 0px; + text-align: center; +} + +QHeaderView::section::vertical::first, +QHeaderView::section::vertical::only-one { + border-top: 1px solid #76797C; +} + +QHeaderView::section::vertical { + border-top: transparent; +} + +QHeaderView::section::horizontal::first, +QHeaderView::section::horizontal::only-one { + border-left: 1px solid #76797C; +} + +QHeaderView::section::horizontal { + border-left: transparent; +} + +QHeaderView::section:checked { + color: #ffffff; + background-color: #31363B; +} + +/*================================================================ +QTableWidget +================================================================*/ +QTableWidget { + background-color: #373b3f; /*#232629;*/ + gridline-color: yellow; /*#31363b;*/ +} + +QTableWidget::item { + outline-style: none; + color: #eff0f1; + background: #31363b; + border: none; + border-bottom: 1px solid #31363b; +} + +/*================================================================ +QTableView - e.g. configMenu()->Syntax highlighting table +================================================================*/ +QTableView { + border: 1px solid #76797C; + gridline-color: #31363b; + background-color: #232629; +} + +QTableView, +QHeaderView { + border-radius: 0px; +} + +QTableView::item:hover { + background: #18465d; +} + +QTableView::item:pressed, +QListView::item:pressed, +QTreeView::item:pressed { + background: #18465d; + color: #eff0f1; +} + +QTableView::item:selected:active, +QTreeView::item:selected:active, +QListView::item:selected:active { + background: #287399; + color: #eff0f1; +} + +QTableCornerButton::section { + background-color: #31363b; + border: 1px transparent #76797C; + border-radius: 0px; +} + +/*================================================================ +QDialog - e.g. config menu, About TXS window, Wizards +================================================================*/ +QDialog { + background-color: #373b3f; +} + +QDialog QCheckBox, +QDialog QLabel { + background-color: transparent; +} + +QDialog QToolButton { /*Same as QPushButton*/ + color: #eff0f1; + background-color: #31363b; + border-width: 1px; + border-color: #76797C; + border-style: solid; + padding: 5px; + border-radius: 2px; + outline: none; +} + +QDialog QToolButton:hover, +QDialog QToolButton:focus { /*Same as QPushButton*/ + background-color: #18465d; + color: #ffffff; +} + +QDialog QToolButton:pressed { /*Same as QPushButton*/ + background-color: #18465d; + padding-top: -15px; + padding-bottom: -17px; +} + +/* Specific to table in "configMenu->Syntax highlighting" (hopefully) */ + +QDialog QTableWidget::item, +QDialog QTableView::item:hover { /* Turn off hover colour for cells -- it's distracting */ + background-color: #31363b; +} + +/* */ + +/*================================================================ +QSlider - e.g. GUI scaling settings +================================================================*/ +QSlider, +QSlider:active, +QSlider:!active { + border: none; + background-color: transparent; +} + +QSlider::groove:horizontal { + height: 12px; +} + +QSlider::groove:vertical { + width: 12px; +} + +QSlider::handle:horizontal, +QSlider::handle:vertical { + background-color: #db1c49; + border: 1px solid #db1c49; + width: 10px; + height: 15px; + border-radius: 8px; +} + +QSlider::handle:horizontal:hover, +QSlider::handle:vertical:hover, +QSlider::handle:horizontal:pressed, +QSlider::handle:vertical:pressed { + border: 1px solid #A21538; + background-color: #A21538; +} + +/*================================================================ +QToolTip - e.g. popup upon hovering on filename tabs +================================================================*/ +QToolTip { + border: 1px solid #272a2d; + background-color: #373b3f; + color: white; + padding: 0px; /*remove padding, for fix combobox tooltip.*/ +} diff --git a/css/qss.css b/css/qss.css new file mode 100644 index 0000000..83cbc7b --- /dev/null +++ b/css/qss.css @@ -0,0 +1,1097 @@ +QssDockWidget#dialog{ + border: 1px solid rgb(111, 156, 207); + font-size : 15px; + padding: 5px; + background: rgb(232, 241, 252); +} +QDialog{ + border: 1px solid rgb(rgb(0, 78, 161)); + font-size : 15px; + padding: 5px; + background: rgb(232, 241, 252); +} +QWidget#player{ +border: 1px solid rgb(111, 156, 207); +font-size : 15px; +background: rgb(232, 241, 252); +} + +QMainWindow{ + border: none; + background: rgb(245, 252, 252); +} + +QMainWindow::title{ + text-align: right; /* align the text to the left */ + background: rgb(7,71,166); + padding-left: 5px; +} + +QDialog::title{ + text-align: left; /* align the text to the left */ + background: lightgray; + padding-left: 5px; +} +QPushButton#btn_serial:enabled { + border-image: url(:/qss/icon/btn_serial.png); + background: rgb(232, 241, 252); + color: white; + margin-left: 10; + margin-top:5; +} + + +QPushButton#btn_serial:enabled:hover{ + background: rgb(100, 160, 220); +} +QPushButton#btn_serial:enabled:pressed{ + background: rgb(0, 78, 161); +} + + +QPushButton#btn_process:enabled { + border-image: url(:/qss/icon/charts.png); + background: rgb(232, 241, 252); + color: white; + margin-left: 10; + margin-top:5; +} +QPushButton#btn_process:!enabled { + background: rgb(180, 180, 180); + color: white; +} +QPushButton#btn_process:enabled:hover{ + background: rgb(100, 160, 220); +} +QPushButton#btn_process:enabled:pressed{ + background: rgb(0, 78, 161); +} + +QWidget { + font-size: 15px; +} +QWidget:QLabel{ + font-size: 15px; + +} +QWidget#customWidget { + background: rgb(173, 202, 232); +} + +/**********子界面中央背景**********/ +QWidget#centerWidget { + background: rgb(232, 241, 1); +} + +/**********主界面样式**********/ +QWidget#mainWindow { + background: rgb(232, 241, 252); +} + +QWidget#messageWidget { + background: rgba(173, 202, 232); +} + +QWidget#loadingWidget { + border: none; + background: rgb(187, 212, 238); +} +QDockWidget{ + background: rgb(187, 212, 238); +} +QFrame#window{ + background: rgba(244,245,247,100); + +} +QWidget#titlebar{ + color: white; + background: rgb(7,71,166); + border: 0px; + margin: 0px; + +} +QWidget#remoteWidget { + border-top-right-radius: 10px; + border-bottom-right-radius: 10px; + border: 1px solid rgb(111, 156, 207); + border-left: none; + background: transparent; +} + +StyledWidget { + qproperty-normalColor: rgb(65, 65, 65); + qproperty-disableColor: rgb(180, 180, 180); + qproperty-highlightColor: rgb(0, 160, 230); + qproperty-errorColor: red; +} + +QProgressIndicator { + qproperty-color: rgb(2, 65, 132); +} + +/**********提示**********/ +QToolTip{ + border: 1px solid rgb(111, 156, 207); + background: white; + color: rgb(51, 51, 51); +} + +/**********菜单栏**********/ +QMenuBar { + background: rgb(7,71,166); + border: 1px solid rgb(111, 156, 207); + border-left: none; + border-right: none; +} +QMenuBar::item { + border: 1px solid transparent; + padding: 5px 10px 5px 10px; + height : 30px; + background: transparent; + text-aligin: center; + font-size: 15px; +} +QMenuBar::item:enabled { + color: rgb(7,71,166); +} +QMenuBar::item:!enabled { + color: rgb(155, 155, 155); +} +QMenuBar::item:enabled:selected { + border-top-color: rgb(111, 156, 207); + border-bottom-color: rgb(111, 156, 207); + background: rgb(198, 224, 252); +} + +/**********菜单**********/ +QMenu { + border: 1px solid rgb(2, 65, 132); + background: rgb(232, 241, 250); + height : 50px; + +} + + +QPushButton#titlebaricon{ + image: url(:/qss/icon/logo.png); + background: rgb(7,71,166); + width: 25px; + height:25px; +} + +QLable#titlebartitle{ + color: white; + font-family: Arial; +} +QPushButton#titlebartitle{ + font: 12px sans-serif; +} +QPushButton#titlebarclosebtn{ + image: url(":/qss/icon/btn_close_down.svg"); + background: rgb(7,71,166); + width: 40px; + height:30px; + margin-left: 1px; +} +QPushButton#titlebarmaxbtn{ + background: rgb(7,71,166); + width: 40px; + height:30px; + margin-left: 1px; + image: url(":/qss/icon/btn_max_normal.svg"); + +} +QPushButton#titlebarclosebtn:enabled:hover{ + background: red; +} +QPushButton#titlebarminbtn{ + image: url(":/qss/icon/btn_mini_down.svg"); + + background: rgb(7,71,166); + width: 40px; + height:30px; + margin-left: 1px; +} +QPushButton#titlebarminbtn:enabled:hover{ + background: rgb(187, 212, 238); +} +QPushButton#titlebarrestorebtn{ + image: url(":/qss/icon/btn_max_normal.svg"); + background: rgb(187, 212, 238); + width: 40px; + height:30px; + margin-left: 1px; +} +QPushButton#titlebarrestorebtn:enabled:hover{ + background: rgb(187, 212, 238); +} + + +QPushButton#btn_serial:!enabled { + background: rgb(180, 180, 180); + color: white; +} + +QPushButton#titlebarmaxbtn:enabled:hover{ + background: rgb(100, 160, 220); +} + +QMenu::item { + height: 22px; + padding: 0px 25px 0px 20px; +} +QMenu::item:enabled { + color: rgb(84, 84, 84); +} +QMenu::item:!enabled { + color: rgb(155, 155, 155); +} +QMenu::item:enabled:selected { + color: rgb(2, 65, 132); + background: rgba(255, 255, 255, 200); +} +QMenu::separator { + height: 1px; + background: rgb(111, 156, 207); +} +QMenu::indicator { + width: 13px; + height: 13px; +} +QMenu::icon { + padding-left: 2px; + padding-right: 2px; +} + +/**********状态栏**********/ +QStatusBar { + background: rgb(111, 156, 207); + border: 1px solid rgb(111, 156, 207); + border-left: none; + border-right: none; + border-bottom: none; +} +QStatusBar::item { + border: none; + border-right: 1px solid rgb(111, 156, 207); +} + +/**********分组框**********/ +QGroupBox { + font-size: 15px; + border: 1px solid rgb(111, 156, 207); + border-radius: 4px; + margin-top: 10px; +} +QGroupBox::title { + color: rgb(56, 99, 154); + top: -12px; + left: 10px; +} +QTabWidget{ + margin-left:10; +} +/**********页签项**********/ +QTabWidget::pane { + border: none; + border-top: 3px solid rgb(0, 78, 161); + background: rgb(187, 212, 238); +} +QTabWidget::tab-bar { + border: none; +} +QTabBar::tab { + border: none; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + color: white; + background: rgb(120, 170, 220); + height: 28px; + min-width: 85px; + margin-right: 5px; + padding-left: 5px; + padding-right: 5px; +} +QTabBar::tab:hover { + background: rgb(0, 78, 161); +} +QTabBar::tab:selected { + color: white; + background: rgb(0, 78, 161); +} + +QTabWidget#tabWidget::pane { + border: 1px solid rgb(111, 156, 207); + background: rgb(232, 241, 252); + margin-top: -1px; +} + +QTabBar#tabBar::tab { + border: 1px solid rgb(111, 156, 207); + border-bottom: none; + color: rgb(70, 71, 73); + background: transparent; +} +QTabBar#tabBar::tab:hover { + color: rgb(2, 65, 132); +} +QTabBar#tabBar::tab:selected { + color: rgb(2, 65, 132); + background: rgb(232, 241, 252); +} + +/**********表头**********/ +QHeaderView{ + border: 1px solid black; + border-bottom: 3px solid rgb(0, 78, 161); + background: transparent; + min-height: 30px; +} +QHeaderView::section:horizontal { + border: none; + color: rgb(2, 65, 132); + background: transparent; + padding-left: 5px; +} +QHeaderView::section:horizontal:hover { + color: white; + background: rgb(0, 78, 161); +} +QHeaderView::section:horizontal:pressed { + color: white; + background: rgb(6, 94, 187); +} +QHeaderView::up-arrow { + width: 13px; + height: 11px; + padding-right: 5px; + image: url(:/White/topArrow); + subcontrol-position: center right; +} +QHeaderView::up-arrow:hover, QHeaderView::up-arrow:pressed { + image: url(:/White/topArrowHover); +} +QHeaderView::down-arrow { + width: 13px; + height: 11px; + padding-right: 5px; + image: url(:/White/bottomArrow); + subcontrol-position: center right; +} +QHeaderView::down-arrow:hover, QHeaderView::down-arrow:pressed { + image: url(:/White/bottomArrowHover); +} +/**********TreeView**********/ +QTreeView::item { + height: 25px; + border-right: 0.5px solid grey; + background: transparent; +} +QTreeView::item:hover { + background : #DBDBDB; +} + +QTreeView::item:selected { + background : grey; +} +/**********表格**********/ +QTableView { + border: 1px solid grey; + background: rgb(224, 238, 255); + gridline-color: rgb(111, 156, 207); +} +QTableView::item { + padding-left: 5px; + padding-right: 5px; + border: 1px solid black; + background: white; +} +QTableView::item:selected { + border: 1px solid black; + + background: rgba(255, 255, 255, 30); +} +QTableView::item:selected:!active { + color: rgb(65, 65, 65); +} +QTableView::indicator { + border: 1px solid black; + + width: 20px; + height: 20px; +} +QTableView::indicator:enabled:unchecked { + + image: url(:/White/checkBox); +} +QTableView::indicator:enabled:unchecked:hover { + image: url(:/White/checkBoxHover); +} +QTableView::indicator:enabled:unchecked:pressed { + image: url(:/White/checkBoxPressed); +} +QTableView::indicator:enabled:checked { + image: url(:/White/checkBoxChecked); +} +QTableView::indicator:enabled:checked:hover { + image: url(:/White/checkBoxCheckedHover); +} +QTableView::indicator:enabled:checked:pressed { + image: url(:/White/checkBoxCheckedPressed); +} +QTableView::indicator:enabled:indeterminate { + image: url(:/White/checkBoxIndeterminate); +} +QTableView::indicator:enabled:indeterminate:hover { + image: url(:/White/checkBoxIndeterminateHover); +} +QTableView::indicator:enabled:indeterminate:pressed { + image: url(:/White/checkBoxIndeterminatePressed); +} + +/**********滚动条-水平**********/ +QScrollBar:horizontal { + height: 20px; + background: transparent; + margin-top: 3px; + margin-bottom: 3px; +} +QScrollBar::handle:horizontal { + height: 20px; + min-width: 30px; + background: rgb(170, 200, 230); + margin-left: 15px; + margin-right: 15px; +} +QScrollBar::handle:horizontal:hover { + background: rgb(165, 195, 225); +} +QScrollBar::sub-line:horizontal { + width: 15px; + background: transparent; + image: url(:/White/arrowLeft); + subcontrol-position: left; +} +QScrollBar::add-line:horizontal { + width: 15px; + background: transparent; + image: url(:/White/arrowRight); + subcontrol-position: right; +} +QScrollBar::sub-line:horizontal:hover { + background: rgb(170, 200, 230); +} +QScrollBar::add-line:horizontal:hover { + background: rgb(170, 200, 230); +} +QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal { + background: transparent; +} + +/**********滚动条-垂直**********/ +QScrollBar:vertical { + width: 20px; + background: transparent; + margin-left: 3px; + margin-right: 3px; +} +QScrollBar::handle:vertical { + width: 20px; + min-height: 30px; + background: rgb(170, 200, 230); + margin-top: 15px; + margin-bottom: 15px; +} +QScrollBar::handle:vertical:hover { + background: rgb(165, 195, 225); +} +QScrollBar::sub-line:vertical { + height: 15px; + background: transparent; + image: url(:/White/topArrow); + subcontrol-position: top; +} +QScrollBar::add-line:vertical { + height: 15px; + background: transparent; + image: url(:/White/bottomArrow); + subcontrol-position: bottom; +} +QScrollBar::sub-line:vertical:hover { + background: rgb(170, 200, 230); +} +QScrollBar::add-line:vertical:hover { + background: rgb(170, 200, 230); +} +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { + background: transparent; +} + +QScrollBar#verticalScrollBar:vertical { + margin-top: 30px; +} + +/**********下拉列表**********/ +QComboBox { + height: 25px; + border: 1px solid rgb(111, 156, 207); + background: white; +} +QComboBox:enabled { + color: rgb(84, 84, 84); +} +QComboBox:!enabled { + color: rgb(80, 80, 80); +} +QComboBox:enabled:hover, QComboBox:enabled:focus { + color: rgb(51, 51, 51); +} +QComboBox::drop-down { + width: 20px; + border: none; + background: transparent; +} +QComboBox::drop-down:hover { + background: rgba(0, 0, 0, 30); +} +QComboBox::down-arrow { + image: url(:/qss/icon/combo_arrow.png); + max-height:100%; + max-width:100%; +} +QComboBox::down-arrow:on { + top: 1px; +} +QComboBox QAbstractItemView { + border: 1px solid rgb(111, 156, 207); + background: white; + outline: none; +} +QComboBox QAbstractItemView::item { + height: 25px; + color: rgb(73, 73, 73); +} +QComboBox QAbstractItemView::item:selected { + background: rgb(232, 241, 250); + color: rgb(2, 65, 132); +} + +/**********进度条**********/ +QProgressBar{ + border: black; + text-align: center; + color: white; + background: rgb(173, 202, 232); +} +QProgressBar::chunk { + background: rgb(16, 135, 209); +} + +QProgressBar { + border: rgb(173, 202, 232); + text-align: center; + color: light; + background-color: transparent; + background-image: rgb(173, 202, 232); + background-repeat: repeat-x; +} +QProgressBar::chunk { + border: none; + background-color:rgb(173, 202, 232); + background-repeat: repeat-x; +} + +/**********复选框**********/ +QCheckBox{ + spacing: 5px; +} +QCheckBox:enabled:checked{ + color: rgb(2, 65, 132); +} +QCheckBox:enabled:!checked{ + color: rgb(70, 71, 73); +} +QCheckBox:enabled:hover{ + color: rgb(0, 78, 161); +} +QCheckBox:!enabled{ + color: rgb(80, 80, 80); +} +QCheckBox::indicator { + width: 20px; + height: 20px; +} +QCheckBox::indicator:unchecked { + image: url(:/qss/icon/checkbox.png); +} +QCheckBox::indicator:unchecked:hover { + image: url(:/qss/icon/checkbox_h.png); +} +QCheckBox::indicator:unchecked:pressed { + image: url(:/qss/icon/checkbox_p.png); +} +QCheckBox::indicator:checked { + image: url(:/qss/icon/check_box_p.png); +} +QCheckBox::indicator:checked:hover { + image: url(:/qss/icon/check_box_p.png); +} +QCheckBox::indicator:checked:pressed { + image: url(:/qss/icon/check_box_p.png); +} +QCheckBox::indicator:indeterminate { + image: url(:/qss/icon/check_box_p.png); +} +QCheckBox::indicator:indeterminate:hover { + image: url(:/qss/icon/check_box_p.png); +} +QCheckBox::indicator:indeterminate:pressed { + image: url(:/qss/icon/check_box_p.png); +} + +/**********单选框**********/ +QRadioButton{ + spacing: 5px; +} +QRadioButton:enabled:checked{ + color: rgb(2, 65, 132); +} +QRadioButton:enabled:!checked{ + color: rgb(70, 71, 73); +} +QRadioButton:enabled:hover{ + color: rgb(0, 78, 161); +} +QRadioButton:!enabled{ + color: rgb(80, 80, 80); +} +QRadioButton::indicator { + width: 20px; + height: 20px; +} +QRadioButton::indicator:unchecked { + image: url(:/White/radioButton); +} +QRadioButton::indicator:unchecked:hover { + image: url(:/White/radioButtonHover); +} +QRadioButton::indicator:unchecked:pressed { + image: url(:/White/radioButtonPressed); +} +QRadioButton::indicator:checked { + image: url(:/White/radioButtonChecked); +} +QRadioButton::indicator:checked:hover { + image: url(:/White/radioButtonCheckedHover); +} +QRadioButton::indicator:checked:pressed { + image: url(:/White/radioButtonCheckedPressed); +} + +/**********输入框**********/ +QLineEdit { + border-radius: 4px; + height: 25px; + border: 1px solid rgb(111, 156, 207); + background: white; +} +QLineEdit:enabled { + color: rgb(84, 84, 84); +} +QLineEdit:enabled:hover, QLineEdit:enabled:focus { + color: rgb(51, 51, 51); +} +QLineEdit:!enabled { + color: rgb(80, 80, 80); +} + +/**********文本编辑框**********/ +QTextEdit { + border: 1px solid rgb(111, 156, 207); + color: rgb(70, 71, 73); + background: rgb(187, 212, 238); +} + +/**********滚动区域**********/ +QScrollArea { + border: 1px solid rgb(111, 156, 207); + background: rgb(187, 212, 238); +} + +/**********滚动区域**********/ +QWidget#transparentWidget { + background: transparent; +} + +/**********微调器**********/ +QSpinBox { + border-radius: 4px; + height: 24px; + min-width: 40px; + border: 1px solid rgb(111, 156, 207); + background: white; +} +QSpinBox:enabled { + color: rgb(60, 60, 60); +} +QSpinBox:enabled:hover, QSpinBox:enabled:focus { + color: rgb(51, 51, 51); +} +QSpinBox:!enabled { + color: rgb(210, 210, 210); + background: transparent; +} +QSpinBox::up-button { + border-left: 1px solid rgb(111, 156, 207); + width: 18px; + height: 12px; + border-top-right-radius: 4px; + image: url(:/White/upButton); +} +QSpinBox::up-button:!enabled { + background: transparent; +} +QSpinBox::up-button:enabled:hover { + background: rgb(255, 255, 255, 30); +} +QSpinBox::down-button { + border-left: 1px solid rgb(111, 156, 207); + width: 18px; + height: 12px; + border-bottom-right-radius: 4px; + image: url(:/White/downButton); +} +QSpinBox::down-button:!enabled { + background: transparent; +} +QSpinBox::down-button:hover { + background: rgb(255, 255, 255, 30); +} +QLabel#label_3{ + font-size: 20px; + background-color: rgb(255, 255, 255, 30); + color : light; +} + +QDockWidget *{ + font-size: 15px; +} +/**********标签**********/ +QLabel#grayLabel { + color: rgb(70, 71, 73); +} + +QLabel#highlightLabel { + color: rgb(2, 65, 132); +} + +QLabel#redLabel { + color: red; +} + +QLabel#grayYaHeiLabel { + color: rgb(175, 175, 175); + font-size: 15px; +} + +QLabel#blueLabel { + color: rgb(0, 160, 230); +} + +QLabel#listLabel { + color: rgb(51, 51, 51); +} + +QLabel#lineBlueLabel { + background: rgb(0, 78, 161); +} + +QLabel#graySeperateLabel { + background: rgb(200, 220, 230); +} + +QLabel#seperateLabel { + background: rgb(112, 153, 194); +} + +QLabel#radiusBlueLabel { + border-radius: 15px; + color: white; + font-size: 15px; + background: rgb(0, 78, 161); +} + +QLabel#skinLabel[colorProperty="normal"] { + color: rgb(56, 99, 154); +} +QLabel#skinLabel[colorProperty="highlight"] { + color: rgb(0, 160, 230); +} + +QLabel#informationLabel { + qproperty-pixmap: url(:/White/information); +} + +QLabel#errorLabel { + qproperty-pixmap: url(:/White/error); +} + +QLabel#successLabel { + qproperty-pixmap: url(:/White/success); +} + +QLabel#questionLabel { + qproperty-pixmap: url(:/White/question); +} + +QLabel#warningLabel { + qproperty-pixmap: url(:/White/warning); +} + +QLabel#groupLabel { + color: rgb(56, 99, 154); + border: 1px solid rgb(111, 156, 207); + font-size: 15px; + border-top-color: transparent; + border-right-color: transparent; + border-left-color: transparent; +} + +/**********按钮**********/ +QToolButton#nsccButton { + border: none; + color: rgb(2, 65, 132); + background: transparent; + padding: 10px; + qproperty-icon: url(:/White/nscc); + qproperty-iconSize: 32px 32px; + qproperty-toolButtonStyle: ToolButtonTextUnderIcon; +} +QToolButton#nsccButton:hover { + background: rgb(187, 212, 238); +} + +QToolButton#transferButton { + border: none; + color: rgb(2, 65, 132); + background: transparent; + padding: 10px; + qproperty-icon: url(:/White/transfer); + qproperty-iconSize: 32px 32px; + qproperty-toolButtonStyle: ToolButtonTextUnderIcon; +} +QToolButton#transferButton:hover { + background: rgb(187, 212, 238); +} + +/**********按钮**********/ +QPushButton{ + border: none; + width: 75px; + height: 25px; + font-size: 15px; + color: black; +} +QPushButton:enabled { + background: rgb(120, 170, 220); + color: white; +} +QPushButton:!enabled { + background: rgb(180, 180, 180); + color: white; +} +QPushButton:enabled:hover{ + background: rgb(100, 160, 220); +} +QPushButton:enabled:pressed{ + background: rgb(0, 78, 161); +} + +QPushButton#blueButton { + color: white; +} +QPushButton#blueButton:enabled { + background: rgb(0, 78, 161); + color: white; +} + +QPushButton#blueButton:enabled:hover { + background: rgb(2, 65, 132); +} +QPushButton#blueButton:enabled:pressed { + background: rgb(6, 94, 187); +} + +QPushButton#selectButton { + border: none; + border-radius: none; + border-left: 1px solid rgb(111, 156, 207); + background: transparent; + image: url(:/White/scan); + color: rgb(51, 51, 51); +} +QPushButton#selectButton:enabled:hover{ + background: rgb(187, 212, 238); +} +QPushButton#selectButton:enabled:pressed{ + background: rgb(120, 170, 220); +} + +QPushButton#linkButton { + background: transparent; + color: rgb(0, 160, 230); + text-align:left; +} +QPushButton#linkButton:hover { + color: rgb(20, 185, 255); + text-decoration: underline; +} +QPushButton#linkButton:pressed { + color: rgb(0, 160, 230); +} + +QPushButton#transparentButton { + background: transparent; +} + +/*****************标题栏按钮*******************/ +QPushButton#minimizeButton { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(120, 170, 220); + image: url(:/White/minimizeHover); +} +QPushButton#minimizeButton:hover { + image: url(:/White/minimize); +} +QPushButton#minimizeButton:pressed { +} + +QPushButton#closeButton { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(120, 170, 220); + image: url(:/qss/icon/btn_close_normal.png); + +} +QPushButton#closeButton:hover { + background: rgb(100, 160, 220); +} +QPushButton#closeButton:pressed { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(80, 170, 220); +} + +QPushButton#skinButton { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(120, 170, 220); + image: url(:/White/skinHover); +} +QPushButton#skinButton:hover { + image: url(:/White/skin); +} +QPushButton#skinButton:pressed { + image: url(:/White/skinPressed); +} + +QPushButton#feedbackButton { + border-radius: none; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + background: rgb(120, 170, 220); + image: url(:/White/feedbackHover); +} +QPushButton#feedbackButton:hover { + image: url(:/White/feedback); +} +QPushButton#feedbackButton:pressed { + image: url(:/White/feedbackPressed); +} + +QPushButton#closeTipButton { + border-radius: none; + border-image: url(:/White/close); + background: transparent; +} +QPushButton#closeTipButton:hover { + border-image: url(:/White/closeHover); +} +QPushButton#closeTipButton:pressed { + border-image: url(:/White/closePressed); +} + +QPushButton#changeSkinButton{ + border-radius: 4px; + border: 2px solid rgb(111, 156, 207); + background: rgb(204, 227, 252); +} +QPushButton#changeSkinButton:hover{ + border-color: rgb(60, 150, 200); +} +QPushButton#changeSkinButton:pressed, QPushButton#changeSkinButton:checked{ + border-color: rgb(0, 160, 230); +} + +QPushButton#transferButton { + padding-left: 5px; + padding-right: 5px; + color: white; + background: rgb(0, 78, 161); +} +QPushButton#transferButton:hover { + background: rgb(2, 65, 132); +} +QPushButton#transferButton:pressed { + background: rgb(6, 94, 187); +} +QPushButton#transferButton[iconProperty="left"] { + qproperty-icon: url(:/White/left); +} +QPushButton#transferButton[iconProperty="right"] { + qproperty-icon: url(:/White/right); +} + +QPushButton#openButton { + border-radius: none; + image: url(:/White/open); + background: transparent; +} +QPushButton#openButton:hover { + image: url(:/White/openHover); +} +QPushButton#openButton:pressed { + image: url(:/White/openPressed); +} + +QPushButton#deleteButton { + border-radius: none; + image: url(:/White/delete); + background: transparent; +} +QPushButton#deleteButton:hover { + image: url(:/White/deleteHover); +} +QPushButton#deleteButton:pressed { + image: url(:/White/deletePressed); +} + +QPushButton#menuButton { + height: 50px; + text-align: left center; + padding-left: 3px; + color: rgb(84, 84, 198); + border: 1px solid rgb(111, 156, 207); + background: white; +} +QPushButton#menuButton::menu-indicator{ + subcontrol-position: right center; + subcontrol-origin: padding; + padding-right: 3px; + height:50px; +} diff --git a/css/white.css b/css/white.css new file mode 100644 index 0000000..847d018 --- /dev/null +++ b/css/white.css @@ -0,0 +1,303 @@ +/* * The MIT License (MIT) * * Copyright : http://blog.csdn.net/liang19890820 * * Author : 一去丶二三里 * * Date : 2016/07/22 * * Description : 白色靓丽 * */ + +/**********子界面背景**********/ +QWidget#customWidget { background: rgb(173, 202, 232); } + +/**********子界面中央背景**********/ +QWidget#centerWidget { background: rgb(232, 241, 252); } + +/**********主界面样式**********/ +QWidget#mainWindow { border: 1px solid rgb(111, 156, 207); background: rgb(232, 241, 252); } + +QWidget#messageWidget { background: rgba(173, 202, 232, 50%); } + +QWidget#loadingWidget { border: none; border-radius: 5px; background: rgb(187, 212, 238); } + +QWidget#remoteWidget { border-top-right-radius: 10px; border-bottom-right-radius: 10px; border: 1px solid rgb(111, 156, 207); border-left: none; background: transparent; } + +StyledWidget { qproperty-normalColor: rgb(65, 65, 65); qproperty-disableColor: rgb(180, 180, 180); qproperty-highlightColor: rgb(0, 160, 230); qproperty-errorColor: red; } + +QProgressIndicator { qproperty-color: rgb(2, 65, 132); } + +/**********提示**********/ +QToolTip{ border: 1px solid rgb(111, 156, 207); background: white; color: rgb(51, 51, 51); } + +/**********菜单栏**********/ +QMenuBar { background: rgb(187, 212, 238); border: 1px solid rgb(111, 156, 207); border-left: none; border-right: none; } +QMenuBar::item { border: 1px solid transparent; padding: 5px 10px 5px 10px; background: transparent; } +QMenuBar::item:enabled { color: rgb(2, 65, 132); } +QMenuBar::item:!enabled { color: rgb(155, 155, 155); } +QMenuBar::item:enabled:selected { border-top-color: rgb(111, 156, 207); border-bottom-color: rgb(111, 156, 207); background: rgb(198, 224, 252); } + +/**********菜单**********/ +QMenu { border: 1px solid rgb(111, 156, 207); background: rgb(232, 241, 250); } +QMenu::item { height: 22px; padding: 0px 25px 0px 20px; } +QMenu::item:enabled { color: rgb(84, 84, 84); } +QMenu::item:!enabled { color: rgb(155, 155, 155); } +QMenu::item:enabled:selected { color: rgb(2, 65, 132); background: rgba(255, 255, 255, 200); } +QMenu::separator { height: 1px; background: rgb(111, 156, 207); } +QMenu::indicator { width: 13px; height: 13px; } +QMenu::icon { padding-left: 2px; padding-right: 2px; } + +/**********状态栏**********/ +QStatusBar { background: rgb(187, 212, 238); border: 1px solid rgb(111, 156, 207); border-left: none; border-right: none; border-bottom: none; } +QStatusBar::item { border: none; border-right: 1px solid rgb(111, 156, 207); } + +/**********分组框**********/ +QGroupBox { font-size: 15px; border: 1px solid rgb(111, 156, 207); border-radius: 4px; margin-top: 10px; } +QGroupBox::title { color: rgb(56, 99, 154); top: -12px; left: 10px; } + +/**********页签项**********/ +QTabWidget::pane { border: none; border-top: 3px solid rgb(0, 78, 161); background: rgb(187, 212, 238); } +QTabWidget::tab-bar { border: none; } +QTabBar::tab { border: none; border-top-left-radius: 4px; border-top-right-radius: 4px; color: white; background: rgb(120, 170, 220); height: 28px; min-width: 85px; margin-right: 5px; padding-left: 5px; padding-right: 5px; } +QTabBar::tab:hover { background: rgb(0, 78, 161); } +QTabBar::tab:selected { color: white; background: rgb(0, 78, 161); } + +QTabWidget#tabWidget::pane { border: 1px solid rgb(111, 156, 207); background: rgb(232, 241, 252); margin-top: -1px; } + +QTabBar#tabBar::tab { border: 1px solid rgb(111, 156, 207); border-bottom: none; color: rgb(70, 71, 73); background: transparent; } +QTabBar#tabBar::tab:hover { color: rgb(2, 65, 132); } +QTabBar#tabBar::tab:selected { color: rgb(2, 65, 132); background: rgb(232, 241, 252); } + +/**********表头**********/ +QHeaderView{ border: none; border-bottom: 3px solid rgb(0, 78, 161); background: transparent; min-height: 30px; } +QHeaderView::section:horizontal { border: none; color: rgb(2, 65, 132); background: transparent; padding-left: 5px; } +QHeaderView::section:horizontal:hover { color: white; background: rgb(0, 78, 161); } +QHeaderView::section:horizontal:pressed { color: white; background: rgb(6, 94, 187); } +QHeaderView::up-arrow { width: 13px; height: 11px; padding-right: 5px; image: url(:/White/topArrow); subcontrol-position: center right; } +QHeaderView::up-arrow:hover, QHeaderView::up-arrow:pressed { image: url(:/White/topArrowHover); } +QHeaderView::down-arrow { width: 13px; height: 11px; padding-right: 5px; image: url(:/White/bottomArrow); subcontrol-position: center right; } +QHeaderView::down-arrow:hover, QHeaderView::down-arrow:pressed { image: url(:/White/bottomArrowHover); } + +/**********表格**********/ +QTableView { border: 1px solid rgb(111, 156, 207); background: rgb(224, 238, 255); gridline-color: rgb(111, 156, 207); } +QTableView::item { padding-left: 5px; padding-right: 5px; border: none; background: white; border-right: 1px solid rgb(111, 156, 207); border-bottom: 1px solid rgb(111, 156, 207); } +QTableView::item:selected { background: rgba(255, 255, 255, 100); } +QTableView::item:selected:!active { color: rgb(65, 65, 65); } +QTableView::indicator { width: 20px; height: 20px; } +QTableView::indicator:enabled:unchecked { image: url(:/White/checkBox); } +QTableView::indicator:enabled:unchecked:hover { image: url(:/White/checkBoxHover); } +QTableView::indicator:enabled:unchecked:pressed { image: url(:/White/checkBoxPressed); } +QTableView::indicator:enabled:checked { image: url(:/White/checkBoxChecked); } +QTableView::indicator:enabled:checked:hover { image: url(:/White/checkBoxCheckedHover); } +QTableView::indicator:enabled:checked:pressed { image: url(:/White/checkBoxCheckedPressed); } +QTableView::indicator:enabled:indeterminate { image: url(:/White/checkBoxIndeterminate); } +QTableView::indicator:enabled:indeterminate:hover { image: url(:/White/checkBoxIndeterminateHover); } +QTableView::indicator:enabled:indeterminate:pressed { image: url(:/White/checkBoxIndeterminatePressed); } + +/**********滚动条-水平**********/ +QScrollBar:horizontal { height: 20px; background: transparent; margin-top: 3px; margin-bottom: 3px; } +QScrollBar::handle:horizontal { height: 20px; min-width: 30px; background: rgb(170, 200, 230); margin-left: 15px; margin-right: 15px; } +QScrollBar::handle:horizontal:hover { background: rgb(165, 195, 225); } +QScrollBar::sub-line:horizontal { width: 15px; background: transparent; image: url(:/White/arrowLeft); subcontrol-position: left; } +QScrollBar::add-line:horizontal { width: 15px; background: transparent; image: url(:/White/arrowRight); subcontrol-position: right; } +QScrollBar::sub-line:horizontal:hover { background: rgb(170, 200, 230); } +QScrollBar::add-line:horizontal:hover { background: rgb(170, 200, 230); } +QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal { background: transparent; } + +/**********滚动条-垂直**********/ +QScrollBar:vertical { width: 20px; background: transparent; margin-left: 3px; margin-right: 3px; } +QScrollBar::handle:vertical { width: 20px; min-height: 30px; background: rgb(170, 200, 230); margin-top: 15px; margin-bottom: 15px; } +QScrollBar::handle:vertical:hover { background: rgb(165, 195, 225); } +QScrollBar::sub-line:vertical { height: 15px; background: transparent; image: url(:/White/topArrow); subcontrol-position: top; } +QScrollBar::add-line:vertical { height: 15px; background: transparent; image: url(:/White/bottomArrow); subcontrol-position: bottom; } +QScrollBar::sub-line:vertical:hover { background: rgb(170, 200, 230); } +QScrollBar::add-line:vertical:hover { background: rgb(170, 200, 230); } +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: transparent; } + +QScrollBar#verticalScrollBar:vertical { margin-top: 30px; } + +/**********下拉列表**********/ +QComboBox { height: 25px; border-radius: 4px; border: 1px solid rgb(111, 156, 207); background: white; } +QComboBox:enabled { color: rgb(84, 84, 84); } +QComboBox:!enabled { color: rgb(80, 80, 80); } +QComboBox:enabled:hover, QComboBox:enabled:focus { color: rgb(51, 51, 51); } +QComboBox::drop-down { width: 20px; border: none; background: transparent; } +QComboBox::drop-down:hover { background: rgba(255, 255, 255, 30); } +QComboBox::down-arrow { image: url(:/White/arrowBottom); } +QComboBox::down-arrow:on { /**top: 1px;**/ } +QComboBox QAbstractItemView { border: 1px solid rgb(111, 156, 207); background: white; outline: none; } +QComboBox QAbstractItemView::item { height: 25px; color: rgb(73, 73, 73); } +QComboBox QAbstractItemView::item:selected { background: rgb(232, 241, 250); color: rgb(2, 65, 132); } + +/**********进度条**********/ +QProgressBar{ border: none; text-align: center; color: white; background: rgb(173, 202, 232); } +QProgressBar::chunk { background: rgb(16, 135, 209); } + +QProgressBar#progressBar { border: none; text-align: center; color: white; background-color: transparent; background-image: url(":/White/progressBar"); background-repeat: repeat-x; } +QProgressBar#progressBar::chunk { border: none; background-color: transparent; background-image: url(":/White/progressBarChunk"); background-repeat: repeat-x; } + +/**********复选框**********/ +QCheckBox{ spacing: 5px; } +QCheckBox:enabled:checked{ color: rgb(2, 65, 132); } +QCheckBox:enabled:!checked{ color: rgb(70, 71, 73); } +QCheckBox:enabled:hover{ color: rgb(0, 78, 161); } +QCheckBox:!enabled{ color: rgb(80, 80, 80); } +QCheckBox::indicator { width: 20px; height: 20px; } +QCheckBox::indicator:unchecked { image: url(:/White/checkBox); } +QCheckBox::indicator:unchecked:hover { image: url(:/White/checkBoxHover); } +QCheckBox::indicator:unchecked:pressed { image: url(:/White/checkBoxPressed); } +QCheckBox::indicator:checked { image: url(:/White/checkBoxChecked); } +QCheckBox::indicator:checked:hover { image: url(:/White/checkBoxCheckedHover); } +QCheckBox::indicator:checked:pressed { image: url(:/White/checkBoxCheckedPressed); } +QCheckBox::indicator:indeterminate { image: url(:/White/checkBoxIndeterminate); } +QCheckBox::indicator:indeterminate:hover { image: url(:/White/checkBoxIndeterminateHover); } +QCheckBox::indicator:indeterminate:pressed { image: url(:/White/checkBoxIndeterminatePressed); } + +/**********单选框**********/ +QRadioButton{ spacing: 5px; } +QRadioButton:enabled:checked{ color: rgb(2, 65, 132); } +QRadioButton:enabled:!checked{ color: rgb(70, 71, 73); } +QRadioButton:enabled:hover{ color: rgb(0, 78, 161); } +QRadioButton:!enabled{ color: rgb(80, 80, 80); } +QRadioButton::indicator { width: 20px; height: 20px; } +QRadioButton::indicator:unchecked { image: url(:/White/radioButton); } +QRadioButton::indicator:unchecked:hover { image: url(:/White/radioButtonHover); } +QRadioButton::indicator:unchecked:pressed { image: url(:/White/radioButtonPressed); } +QRadioButton::indicator:checked { image: url(:/White/radioButtonChecked); } +QRadioButton::indicator:checked:hover { image: url(:/White/radioButtonCheckedHover); } +QRadioButton::indicator:checked:pressed { image: url(:/White/radioButtonCheckedPressed); } + +/**********输入框**********/ +QLineEdit { border-radius: 4px; height: 25px; border: 1px solid rgb(111, 156, 207); background: white; } +QLineEdit:enabled { color: rgb(84, 84, 84); } +QLineEdit:enabled:hover, QLineEdit:enabled:focus { color: rgb(51, 51, 51); } +QLineEdit:!enabled { color: rgb(80, 80, 80); } + +/**********文本编辑框**********/ +QTextEdit { border: 1px solid rgb(111, 156, 207); color: rgb(70, 71, 73); background: rgb(187, 212, 238); } + +/**********滚动区域**********/ +QScrollArea { border: 1px solid rgb(111, 156, 207); background: rgb(187, 212, 238); } + +/**********滚动区域**********/ +QWidget#transparentWidget { background: transparent; } + +/**********微调器**********/ +QSpinBox { border-radius: 4px; height: 24px; min-width: 40px; border: 1px solid rgb(111, 156, 207); background: white; } +QSpinBox:enabled { color: rgb(60, 60, 60); } +QSpinBox:enabled:hover, QSpinBox:enabled:focus { color: rgb(51, 51, 51); } +QSpinBox:!enabled { color: rgb(210, 210, 210); background: transparent; } +QSpinBox::up-button { border-left: 1px solid rgb(111, 156, 207); width: 18px; height: 12px; border-top-right-radius: 4px; image: url(:/White/upButton); } +QSpinBox::up-button:!enabled { background: transparent; } +QSpinBox::up-button:enabled:hover { background: rgb(255, 255, 255, 30); } +QSpinBox::down-button { border-left: 1px solid rgb(111, 156, 207); width: 18px; height: 12px; border-bottom-right-radius: 4px; image: url(:/White/downButton); } +QSpinBox::down-button:!enabled { background: transparent; } +QSpinBox::down-button:hover { background: rgb(255, 255, 255, 30); } + +/**********标签**********/ +QLabel#grayLabel { color: rgb(70, 71, 73); } + +QLabel#highlightLabel { color: rgb(2, 65, 132); } + +QLabel#redLabel { color: red; } + +QLabel#grayYaHeiLabel { color: rgb(175, 175, 175); font-size: 16px; } + +QLabel#blueLabel { color: rgb(0, 160, 230); } + +QLabel#listLabel { color: rgb(51, 51, 51); } + +QLabel#lineBlueLabel { background: rgb(0, 78, 161); } + +QLabel#graySeperateLabel { background: rgb(200, 220, 230); } + +QLabel#seperateLabel { background: rgb(112, 153, 194); } + +QLabel#radiusBlueLabel { border-radius: 15px; color: white; font-size: 16px; background: rgb(0, 78, 161); } + +QLabel#skinLabel[colorProperty="normal"] { color: rgb(56, 99, 154); } +QLabel#skinLabel[colorProperty="highlight"] { color: rgb(0, 160, 230); } + +QLabel#informationLabel { qproperty-pixmap: url(:/White/information); } + +QLabel#errorLabel { qproperty-pixmap: url(:/White/error); } + +QLabel#successLabel { qproperty-pixmap: url(:/White/success); } + +QLabel#questionLabel { qproperty-pixmap: url(:/White/question); } + +QLabel#warningLabel { qproperty-pixmap: url(:/White/warning); } + +QLabel#groupLabel { color: rgb(56, 99, 154); border: 1px solid rgb(111, 156, 207); font-size: 15px; border-top-color: transparent; border-right-color: transparent; border-left-color: transparent; } + +/**********按钮**********/ +QToolButton#nsccButton { border: none; color: rgb(2, 65, 132); background: transparent; padding: 10px; qproperty-icon: url(:/White/nscc); qproperty-iconSize: 32px 32px; qproperty-toolButtonStyle: ToolButtonTextUnderIcon; } +QToolButton#nsccButton:hover { background: rgb(187, 212, 238); } + +QToolButton#transferButton { border: none; color: rgb(2, 65, 132); background: transparent; padding: 10px; qproperty-icon: url(:/White/transfer); qproperty-iconSize: 32px 32px; qproperty-toolButtonStyle: ToolButtonTextUnderIcon; } +QToolButton#transferButton:hover { background: rgb(187, 212, 238); } + +/**********按钮**********/ +QPushButton{ border-radius: 4px; border: none; width: 75px; height: 25px; } +QPushButton:enabled { background: rgb(120, 170, 220); color: white; } +QPushButton:!enabled { background: rgb(180, 180, 180); color: white; } +QPushButton:enabled:hover{ background: rgb(100, 160, 220); } +QPushButton:enabled:pressed{ background: rgb(0, 78, 161); } + +QPushButton#blueButton { color: white; } +QPushButton#blueButton:enabled { background: rgb(0, 78, 161); color: white; } +QPushButton:!enabled { background: rgb(180, 180, 180); color: white; } +QPushButton#blueButton:enabled:hover { background: rgb(2, 65, 132); } +QPushButton#blueButton:enabled:pressed { background: rgb(6, 94, 187); } + +QPushButton#selectButton { border: none; border-radius: none; border-left: 1px solid rgb(111, 156, 207); background: transparent; image: url(:/White/scan); color: rgb(51, 51, 51); } +QPushButton#selectButton:enabled:hover{ background: rgb(187, 212, 238); } +QPushButton#selectButton:enabled:pressed{ background: rgb(120, 170, 220); } + +QPushButton#linkButton { background: transparent; color: rgb(0, 160, 230); text-align:left; } +QPushButton#linkButton:hover { color: rgb(20, 185, 255); text-decoration: underline; } +QPushButton#linkButton:pressed { color: rgb(0, 160, 230); } + +QPushButton#transparentButton { background: transparent; } + +/*****************标题栏按钮*******************/ +QPushButton#minimizeButton { border-radius: none; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; background: rgb(120, 170, 220); image: url(:/White/minimizeHover); } +QPushButton#minimizeButton:hover { image: url(:/White/minimize); } +QPushButton#minimizeButton:pressed { image: url(:/White/minimizePressed); } + +QPushButton#maximizeButton[maximizeProperty="maximize"] { border-radius: none; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; background: rgb(120, 170, 220); image: url(:/White/maximizeHover); } +QPushButton#maximizeButton[maximizeProperty="maximize"]:hover { image: url(:/White/maximize); } +QPushButton#maximizeButton[maximizeProperty="maximize"]:pressed { image: url(:/White/maximizePressed); } + +QPushButton#maximizeButton[maximizeProperty="restore"] { border-radius: none; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; background: rgb(120, 170, 220); image: url(:/White/restoreHover); } +QPushButton#maximizeButton[maximizeProperty="restore"]:hover { image: url(:/White/restore); } +QPushButton#maximizeButton[maximizeProperty="restore"]:pressed { image: url(:/White/restorePressed); } + +QPushButton#closeButton { border-radius: none; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; background: rgb(120, 170, 220); image: url(:/White/closeHover); } +QPushButton#closeButton:hover { image: url(:/White/close); } +QPushButton#closeButton:pressed { image: url(:/White/closePressed); } + +QPushButton#skinButton { border-radius: none; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; background: rgb(120, 170, 220); image: url(:/White/skinHover); } +QPushButton#skinButton:hover { image: url(:/White/skin); } +QPushButton#skinButton:pressed { image: url(:/White/skinPressed); } + +QPushButton#feedbackButton { border-radius: none; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; background: rgb(120, 170, 220); image: url(:/White/feedbackHover); } +QPushButton#feedbackButton:hover { image: url(:/White/feedback); } +QPushButton#feedbackButton:pressed { image: url(:/White/feedbackPressed); } + +QPushButton#closeTipButton { border-radius: none; border-image: url(:/White/close); background: transparent; } +QPushButton#closeTipButton:hover { border-image: url(:/White/closeHover); } +QPushButton#closeTipButton:pressed { border-image: url(:/White/closePressed); } + +QPushButton#changeSkinButton{ border-radius: 4px; border: 2px solid rgb(111, 156, 207); background: rgb(204, 227, 252); } +QPushButton#changeSkinButton:hover{ border-color: rgb(60, 150, 200); } +QPushButton#changeSkinButton:pressed, QPushButton#changeSkinButton:checked{ border-color: rgb(0, 160, 230); } + +QPushButton#transferButton { padding-left: 5px; padding-right: 5px; color: white; background: rgb(0, 78, 161); } +QPushButton#transferButton:hover { background: rgb(2, 65, 132); } +QPushButton#transferButton:pressed { background: rgb(6, 94, 187); } +QPushButton#transferButton[iconProperty="left"] { qproperty-icon: url(:/White/left); } +QPushButton#transferButton[iconProperty="right"] { qproperty-icon: url(:/White/right); } + +QPushButton#openButton { border-radius: none; image: url(:/White/open); background: transparent; } +QPushButton#openButton:hover { image: url(:/White/openHover); } +QPushButton#openButton:pressed { image: url(:/White/openPressed); } + +QPushButton#deleteButton { border-radius: none; image: url(:/White/delete); background: transparent; } +QPushButton#deleteButton:hover { image: url(:/White/deleteHover); } +QPushButton#deleteButton:pressed { image: url(:/White/deletePressed); } + +QPushButton#menuButton { text-align: left center; padding-left: 3px; color: rgb(84, 84, 84); border: 1px solid rgb(111, 156, 207); background: white; } +QPushButton#menuButton::menu-indicator{ subcontrol-position: right center; subcontrol-origin: padding; image: url(:/White/arrowBottom); padding-right: 3px; } diff --git a/icon/Thumbs.db b/icon/Thumbs.db new file mode 100644 index 0000000..fb49600 Binary files /dev/null and b/icon/Thumbs.db differ diff --git a/icon/action_config.png b/icon/action_config.png new file mode 100644 index 0000000..f7e64b6 Binary files /dev/null and b/icon/action_config.png differ diff --git a/icon/btn_close_down.png b/icon/btn_close_down.png new file mode 100644 index 0000000..814cdc7 Binary files /dev/null and b/icon/btn_close_down.png differ diff --git a/icon/btn_close_down.svg b/icon/btn_close_down.svg new file mode 100644 index 0000000..095ee89 --- /dev/null +++ b/icon/btn_close_down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon/btn_close_highlight.png b/icon/btn_close_highlight.png new file mode 100644 index 0000000..2bc66bb Binary files /dev/null and b/icon/btn_close_highlight.png differ diff --git a/icon/btn_close_normal.png b/icon/btn_close_normal.png new file mode 100644 index 0000000..11c1f52 Binary files /dev/null and b/icon/btn_close_normal.png differ diff --git a/icon/btn_data.png b/icon/btn_data.png new file mode 100644 index 0000000..61329e1 Binary files /dev/null and b/icon/btn_data.png differ diff --git a/icon/btn_max_down.png b/icon/btn_max_down.png new file mode 100644 index 0000000..ab159f8 Binary files /dev/null and b/icon/btn_max_down.png differ diff --git a/icon/btn_max_highlight.png b/icon/btn_max_highlight.png new file mode 100644 index 0000000..f9a2a1b Binary files /dev/null and b/icon/btn_max_highlight.png differ diff --git a/icon/btn_max_normal.png b/icon/btn_max_normal.png new file mode 100644 index 0000000..cb065af Binary files /dev/null and b/icon/btn_max_normal.png differ diff --git a/icon/btn_max_normal.svg b/icon/btn_max_normal.svg new file mode 100644 index 0000000..daacc05 --- /dev/null +++ b/icon/btn_max_normal.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon/btn_mini_down.png b/icon/btn_mini_down.png new file mode 100644 index 0000000..d7a579a Binary files /dev/null and b/icon/btn_mini_down.png differ diff --git a/icon/btn_mini_down.svg b/icon/btn_mini_down.svg new file mode 100644 index 0000000..4ae753b --- /dev/null +++ b/icon/btn_mini_down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon/btn_mini_highlight.png b/icon/btn_mini_highlight.png new file mode 100644 index 0000000..71b6020 Binary files /dev/null and b/icon/btn_mini_highlight.png differ diff --git a/icon/btn_mini_normal.png b/icon/btn_mini_normal.png new file mode 100644 index 0000000..644727a Binary files /dev/null and b/icon/btn_mini_normal.png differ diff --git a/icon/btn_restore_down.png b/icon/btn_restore_down.png new file mode 100644 index 0000000..67b4705 Binary files /dev/null and b/icon/btn_restore_down.png differ diff --git a/icon/btn_restore_down.svg b/icon/btn_restore_down.svg new file mode 100644 index 0000000..04bc9e2 --- /dev/null +++ b/icon/btn_restore_down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon/btn_restore_highlight.png b/icon/btn_restore_highlight.png new file mode 100644 index 0000000..f57eb81 Binary files /dev/null and b/icon/btn_restore_highlight.png differ diff --git a/icon/btn_restore_normal.png b/icon/btn_restore_normal.png new file mode 100644 index 0000000..e53f9c1 Binary files /dev/null and b/icon/btn_restore_normal.png differ diff --git a/icon/btn_serial.png b/icon/btn_serial.png new file mode 100644 index 0000000..8543aa8 Binary files /dev/null and b/icon/btn_serial.png differ diff --git a/icon/charts.png b/icon/charts.png new file mode 100644 index 0000000..ddb2e5b Binary files /dev/null and b/icon/charts.png differ diff --git a/icon/check_box_p.png b/icon/check_box_p.png new file mode 100644 index 0000000..33c8d49 Binary files /dev/null and b/icon/check_box_p.png differ diff --git a/icon/checkbox.png b/icon/checkbox.png new file mode 100644 index 0000000..2c56aa4 Binary files /dev/null and b/icon/checkbox.png differ diff --git a/icon/checkbox_h.png b/icon/checkbox_h.png new file mode 100644 index 0000000..3d89dc3 Binary files /dev/null and b/icon/checkbox_h.png differ diff --git a/icon/checkbox_p.png b/icon/checkbox_p.png new file mode 100644 index 0000000..8f8d37b Binary files /dev/null and b/icon/checkbox_p.png differ diff --git a/icon/close_main.png b/icon/close_main.png new file mode 100644 index 0000000..3356428 Binary files /dev/null and b/icon/close_main.png differ diff --git a/icon/code-array.svg b/icon/code-array.svg new file mode 100644 index 0000000..0434557 --- /dev/null +++ b/icon/code-array.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon/combo_arrow.png b/icon/combo_arrow.png new file mode 100644 index 0000000..6ad0a08 Binary files /dev/null and b/icon/combo_arrow.png differ diff --git a/icon/dataflow.svg b/icon/dataflow.svg new file mode 100644 index 0000000..0c69265 --- /dev/null +++ b/icon/dataflow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon/downarrow.png b/icon/downarrow.png new file mode 100644 index 0000000..b810e44 Binary files /dev/null and b/icon/downarrow.png differ diff --git a/icon/hor_scroll_left_arrow.png b/icon/hor_scroll_left_arrow.png new file mode 100644 index 0000000..1093f6e Binary files /dev/null and b/icon/hor_scroll_left_arrow.png differ diff --git a/icon/hor_scroll_right_arrow.png b/icon/hor_scroll_right_arrow.png new file mode 100644 index 0000000..cc3bf17 Binary files /dev/null and b/icon/hor_scroll_right_arrow.png differ diff --git a/icon/int.svg b/icon/int.svg new file mode 100644 index 0000000..c01e055 --- /dev/null +++ b/icon/int.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon/key.svg b/icon/key.svg new file mode 100644 index 0000000..cda69f7 --- /dev/null +++ b/icon/key.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon/logo.png b/icon/logo.png new file mode 100644 index 0000000..5fbeb2a Binary files /dev/null and b/icon/logo.png differ diff --git a/icon/missing.svg b/icon/missing.svg new file mode 100644 index 0000000..fba40ff --- /dev/null +++ b/icon/missing.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon/objects.svg b/icon/objects.svg new file mode 100644 index 0000000..348d62b --- /dev/null +++ b/icon/objects.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon/radio.png b/icon/radio.png new file mode 100644 index 0000000..8c32808 Binary files /dev/null and b/icon/radio.png differ diff --git a/icon/radio_h.png b/icon/radio_h.png new file mode 100644 index 0000000..84407ba Binary files /dev/null and b/icon/radio_h.png differ diff --git a/icon/radio_p.png b/icon/radio_p.png new file mode 100644 index 0000000..4f32d5e Binary files /dev/null and b/icon/radio_p.png differ diff --git a/icon/sizegrip.png b/icon/sizegrip.png new file mode 100644 index 0000000..f2667b9 Binary files /dev/null and b/icon/sizegrip.png differ diff --git a/icon/string.svg b/icon/string.svg new file mode 100644 index 0000000..924a541 --- /dev/null +++ b/icon/string.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon/ver_scroll_bottom_arrow.png b/icon/ver_scroll_bottom_arrow.png new file mode 100644 index 0000000..2be161f Binary files /dev/null and b/icon/ver_scroll_bottom_arrow.png differ diff --git a/icon/ver_scroll_top_arrow.png b/icon/ver_scroll_top_arrow.png new file mode 100644 index 0000000..a8e4fed Binary files /dev/null and b/icon/ver_scroll_top_arrow.png differ diff --git a/icon/最大化.svg b/icon/最大化.svg new file mode 100644 index 0000000..1ba5263 --- /dev/null +++ b/icon/最大化.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/qss.qrc b/qss.qrc new file mode 100644 index 0000000..0c24518 --- /dev/null +++ b/qss.qrc @@ -0,0 +1,51 @@ + + + icon/btn_close_down.png + icon/btn_close_highlight.png + icon/btn_close_normal.png + icon/btn_max_down.png + icon/btn_max_highlight.png + icon/btn_max_normal.png + icon/btn_mini_down.png + icon/btn_mini_highlight.png + icon/btn_mini_normal.png + icon/btn_restore_down.png + icon/btn_restore_highlight.png + icon/btn_restore_normal.png + icon/checkbox.png + icon/checkbox_h.png + icon/checkbox_p.png + icon/downarrow.png + icon/hor_scroll_left_arrow.png + icon/hor_scroll_right_arrow.png + icon/radio.png + icon/radio_h.png + icon/radio_p.png + icon/ver_scroll_bottom_arrow.png + icon/ver_scroll_top_arrow.png + icon/sizegrip.png + css/qss.css + icon/btn_serial.png + css/white.css + css/dark.css + icon/btn_data.png + icon/dataflow.svg + icon/check_box_p.png + icon/combo_arrow.png + icon/charts.png + icon/btn_max_normal.svg + icon/btn_restore_down.svg + icon/btn_mini_down.svg + icon/btn_close_down.svg + icon/close_main.png + icon/logo.png + icon/key.svg + icon/action_config.png + icon/code-array.svg + icon/int.svg + icon/objects.svg + icon/string.svg + icon/最大化.svg + icon/missing.svg + + diff --git a/qsswraper.pri b/qsswraper.pri new file mode 100644 index 0000000..49ec569 --- /dev/null +++ b/qsswraper.pri @@ -0,0 +1,9 @@ +INCLUDEPATH += $$PWD +DEPENDPATH += $$PWD + +HEADERS += $$PWD/Qss.h + +SOURCES += $$PWD/Qss.cpp + +RESOURCES += $$PWD/qss.qrc +