예제 #1
0
void KylinFontDialog::initConnect()
{
//    connect(title_bar, SIGNAL(showMinDialog()), this, SLOT(onMinButtonClicked()));
    connect(title_bar,SIGNAL(closeDialog()), this, SLOT(onCacelButtonClicked()));
    connect(font_view, SIGNAL(clicked(QModelIndex)), this, SLOT(updateAll(QModelIndex)));
    connect(style_view, SIGNAL(clicked(QModelIndex)), this, SLOT(updateStyleandSize(QModelIndex)));
    connect(size_view, SIGNAL(clicked(QModelIndex)), this, SLOT(updateSize(QModelIndex)));
    connect(cacel_btn, SIGNAL(clicked()), this, SLOT(onCacelButtonClicked()));
    connect(ok_btn, SIGNAL(clicked()), this, SLOT(onOKButtonClicked()));
}
예제 #2
0
KFontDialog::KFontDialog(QSettings *mSettings, QString flag, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::KFontDialog)
{
    ui->setupUi(this);
    this->setAttribute(Qt::WA_DeleteOnClose);//防止内存泄漏
    this->setWindowFlags(Qt::FramelessWindowHint);
    this->setAttribute(Qt::WA_TranslucentBackground);
    ui->btn_close->installEventFilter(this);
    ui->okBtn->installEventFilter(this);
    ui->quitBtn->installEventFilter(this);
    ui->btn_close->setStyleSheet("border-image:url(:/pixmap/image/closeBtn.png)");
    ui->okBtn->setStyleSheet("QPushButton {border-image:url(:/pixmap/image/ok.png);}"
                "QPushButton:hover{border-image:url(:/pixmap/image/ok-hover.png);}");
    ui->quitBtn->setStyleSheet("QPushButton {border-image:url(:/pixmap/image/quit.png);}"
                "QPushButton:hover{border-image:url(:/pixmap/image/quit-hover.png);}");
    ui->curFontText->setStyleSheet("color: green");

    ui->familyEdit->setReadOnly(true);
    ui->familyEdit->setFocusProxy(ui->familyList);
    ui->fontLabel->setBuddy(ui->familyList);
    ui->styleEdit->setReadOnly(true);
    ui->styleEdit->setFocusProxy(ui->styleList);
    ui->styleLabel->setBuddy(ui->styleList);
    ui->sizeEdit->setReadOnly(true);
    ui->sizeEdit->setFocusProxy(ui->sizeList);
    ui->sizeLabel->setBuddy(ui->sizeList);
    ui->sampleEdit->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
    ui->sampleEdit->setAlignment(Qt::AlignCenter);
    pSettings = mSettings;
    fontFlag = flag;
    getInitFont();//得到初始字体
    familymodel = new QStringListModel;
    stylemodel = new QStringListModel;
    sizemodel = new QStringListModel;
    initDialog();//初始化字体对话框
    connect(ui->familyList, SIGNAL(clicked(QModelIndex)), this, SLOT(updateAll(QModelIndex)));
    connect(ui->styleList, SIGNAL(clicked(QModelIndex)), this, SLOT(updateStyleandSize(QModelIndex)));
    connect(ui->sizeList, SIGNAL(clicked(QModelIndex)), this, SLOT(updateSize(QModelIndex)));
}