조회 수 14125 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

가장 권장되는 방법은 Qt 스타일 시트를 사용하는 것이다.

 
QLabel의 텍스트 색과 배경색을 변경하려면 다음과 같이한다. :
QLabel* pLabel = new QLabel;
pLabel->setStyleSheet("QLabel { background-color : red; color : blue; }");
 
Qt 스타일 시트를 사용하지 않고 QLabel의 QPalette 을 이용할 수도 있지만 플랫폼 및 스타일에 따라 결과가 다를 수 있다.
 
Qt 문서에 따르면 :
QPalette를 사용한다고해서 모든 스타일에서 작동하는 것은 아니다. 플랫폼의 지침과 기본 테마 엔진에 의해 제한되기 때문이다.
 
QPalette를 사용하려면 이런 식으로 할 수 있다 :
QPalette palette = ui->pLabel->palette();
palette.setColor(ui->pLabel->backgroundRole(), Qt::yellow);
palette.setColor(ui->pLabel->foregroundRole(), Qt::yellow);
ui->pLabel->setPalette(palette);
 
그러나 QPalette를 사용하는 것보다 Qt 스타일 시트를 사용하는 것이 좋다.

  1. No Image notice

    Qt프로그래밍(QtQuick) Beginner를 위한 글 읽는 순서

    Date2019.01.05 CategoryQML and Qt Quick By운영자 Views131086
    read more
  2. UI 폼(Form)작성 시 탭 순서(Tab Order) 설정

    Date2020.08.24 CategoryGeneral and Desktop Bymakersweb Views12700
    Read More
  3. No Image

    Qt로 데이터를 직렬화(serialization)하는 방법

    Date2020.08.04 CategoryC++ Class Bymakersweb Views7872
    Read More
  4. 최초의 Qt 6.0 스냅샷 제공 (First Qt 6.0 Snapshot Available)

    Date2020.06.21 CategoryQt 6 Byj2doll Views7694
    Read More
  5. Qt MQTT 에 대해서

    Date2020.06.02 CategoryMobile and Embedded Bymakersweb Views6077
    Read More
  6. Embedded Linux 에서 Qt 및 Graphics Stack

    Date2020.05.27 By운영자 Views5251
    Read More
  7. ShaderEffect QML Type을 이용한 버튼 클릭 효과

    Date2020.05.22 CategoryQML and Qt Quick Bymakersweb Views5928
    Read More
  8. Qt기반의 서버와 클라이언트간 SOAP(Simple Object Access Protocol)

    Date2020.05.11 CategoryGeneral and Desktop Bymakersweb Views6508
    Read More
  9. No Image

    재진입(Reentrancy) 및 스레드 안전성(Thread-Safety)

    Date2020.04.19 CategoryC++ Class Bymakersweb Views9042
    Read More
  10. No Image

    Qt 5.15 및 Qt 6의 출시 일정

    Date2020.04.09 CategoryQt 6 Bymakersweb Views6832
    Read More
  11. 콘솔에서 사용자 입력받기

    Date2020.03.22 CategoryGeneral and Desktop Bymakersweb Views59347
    Read More
  12. No Image

    컨테이너 클래스 - QVector

    Date2020.03.17 CategoryC++ Class Bymakersweb Views9586
    Read More
  13. Qt로 작성된 안드로이드 APP에 Splash Screen을 추가

    Date2020.03.10 CategoryMobile and Embedded Bymakersweb Views6297
    Read More
  14. No Image

    QLabel의 텍스트 색과 배경색을 변경

    Date2020.02.25 CategoryC++ Class Bymakersweb Views14125
    Read More
  15. 라즈베리파이4에 대한 Qt 5.14.1 크로스컴파일

    Date2020.02.12 CategoryMobile and Embedded Bymakersweb Views10738
    Read More
  16. QOpenGLWidget 을 투명하게 적용

    Date2020.02.05 CategoryGeneral and Desktop Bymakersweb Views7204
    Read More
  17. No Image

    2020년에 변경되는 Qt 오퍼 (Qt offering changes 2020)

    Date2020.01.31 CategoryGeneral and Desktop Byj2doll Views8156
    Read More
  18. No Image

    Qt로 XML 파싱 : Qt 6에서 업데이트된 (Parsing XML with Qt: Updates for Qt 6)

    Date2020.01.16 CategoryQt 6 Byj2doll Views7816
    Read More
  19. No Image

    Qt 멀티 스레드 프로그래밍 시 유의해야 할 몇 가지

    Date2020.01.13 CategoryGeneral and Desktop Bymakersweb Views11937
    Read More
  20. ApplicationWindow 와 메뉴바(MenuBar)구성

    Date2020.01.04 CategoryQML and Qt Quick Bymakersweb Views5260
    Read More
  21. No Image

    QThread 소개 및 예제

    Date2019.12.25 CategoryC++ Class Bymakersweb Views28008
    Read More
Board Pagination Prev 1 2 3 4 5 6 9 Next
/ 9