QTfrontend/ui/widget/hatprompt.cpp
changeset 8453 06541556df53
parent 8434 4821897a0f10
child 8488 e72f3398a28b
equal deleted inserted replaced
8452:170afc3ac39f 8453:06541556df53
    26 #include <QModelIndex>
    26 #include <QModelIndex>
    27 #include <QListView>
    27 #include <QListView>
    28 #include <QLineEdit>
    28 #include <QLineEdit>
    29 #include <QLabel>
    29 #include <QLabel>
    30 #include <QSortFilterProxyModel>
    30 #include <QSortFilterProxyModel>
       
    31 #include <QFontMetrics>
    31 #include <QDebug>
    32 #include <QDebug>
    32 
    33 
    33 #include "DataManager.h"
    34 #include "DataManager.h"
    34 #include "lineeditcursor.h"
    35 #include "lineeditcursor.h"
    35 #include "HatModel.h"
    36 #include "HatModel.h"
    83     connect(txtFilter, SIGNAL(moveLeft()), this, SLOT(moveLeft()));
    84     connect(txtFilter, SIGNAL(moveLeft()), this, SLOT(moveLeft()));
    84     connect(txtFilter, SIGNAL(moveRight()), this, SLOT(moveRight()));
    85     connect(txtFilter, SIGNAL(moveRight()), this, SLOT(moveRight()));
    85 
    86 
    86     // Filter label
    87     // Filter label
    87     QLabel * lblFilter = new QLabel(tr("Filter: "), txtFilter);
    88     QLabel * lblFilter = new QLabel(tr("Filter: "), txtFilter);
    88     lblFilter->setStyleSheet(QString("background: none; margin-left: -%1px; margin-top: 4px;").arg(lblFilter->width() / 2 - 3));
    89     QFontMetrics lblMetrics(lblFilter->font());
    89     txtFilter->setStyleSheet(QString("border-width: 0px; background-color: rgb(13, 5, 68); border-radius: 6px; margin-top: 3px; margin-right: 3px; padding-left: %1px; padding-bottom: 2px;").arg(lblFilter->width() / 2));
    90     int lblFilterWidth = lblMetrics.width(lblFilter->text());
       
    91     lblFilter->setStyleSheet(QString("background: none; margin-left: -%1px; margin-top: 4px;").arg(lblFilterWidth + 5));
       
    92     txtFilter->setStyleSheet(QString("LineEditCursor, QLabel { border-width: 0px; border-radius: 6px; margin-top: 3px; margin-right: 3px; padding-left: %1px; padding-bottom: 2px; background-color: rgb(23, 11, 54); } LineEditCursor:hover, LineEditCursor:focus { background-color: rgb(13, 5, 68); }").arg(lblFilterWidth + 5));
    90 
    93 
    91     // Corner widget
    94     // Corner widget
    92     QLabel * corner = new QLabel();
    95     QLabel * corner = new QLabel();
    93     corner->setPixmap(QPixmap(QString::fromUtf8(":/res/inverse-corner-bl.png")));
    96     corner->setPixmap(QPixmap(QString::fromUtf8(":/res/inverse-corner-bl.png")));
    94     corner->setFixedSize(10, 10);
    97     corner->setFixedSize(10, 10);