Qt (Font,Size,Color)

Qt 2011. 6. 30. 14:48


QPalette 이용


QPalette palette;

//white text
QBrush brush(QColor(255, 255, 255, 255));
brush.setStyle(Qt::SolidPattern);

//black background
QBrush brush1(QColor(0, 0, 0, 255));
brush1.setStyle(Qt::SolidPattern);

    //set white text   
palette.setBrush(QPalette::Active, QPalette::WindowText, brush);
palette.setBrush(QPalette::Inactive, QPalette::WindowText, brush);

//set black background
palette.setBrush(QPalette::Active, QPalette::Window, brush1);
palette.setBrush(QPalette::Inactive, QPalette::Window, brush1);

    //set palette   
textLabel->setPalette(palette);

    //set font   
QFont font;
font.setPointSize(32);
font.setBold(true);

textLabel->setFont(font);
textLabel->setAutoFillBackground(true);




HTML 이용

QLabel *textLabel = new QLabel(this);
textLabel  -> setStyleSheet("background-color: black");
textLabel  -> setText("<font size= "32" color="white"> <b> </b></font>");


 lb_Indicator_LocationMenu->setText(QString::fromLocal8Bit("<font color=\"white\",font size=\"3\">현재 위치</font>"));

'Qt' 카테고리의 다른 글

Qt Reference Documentation  (0) 2011.07.01
Exporting from Adobe Photoshop to QML  (0) 2011.06.30
Qt wince6.0 opengl 컴파일  (1) 2011.06.28
MySQL - Qt 한글 출력문제  (0) 2011.06.27
Qt 4.7 and MySQL-plugin with Mingw on Windows XP(Eclipse)  (0) 2011.06.22
Posted by 요지
,