정리

'QT'에 해당되는 글 2건

  1. Qt 5.x GUI 프로젝트 opengl 관련 빌드 오류
  2. Style Sheet Syntax : Selector

Qt 5.x GUI 프로젝트 opengl 관련 빌드 오류

저장소/Qt

Qt 5.x GUI 프로젝트를 새로 만들어서 빌드할 때 다음과 같은 에러가 발생한다면


1>C:\Qt\Qt5.1.1\5.1.1\msvc2012\include\QtGui/qopengl.h(82): fatal error C1083: 포함 파일을 열 수 없습니다. 'GLES2/gl2.h': No such file or directory


추가 포함 디렉토리에 아래와 같이 추가하여 다시 빌드하면 정상 빌드된다.


$(QTDIR)\include\QtANGLE


Qt OpenGL 라이브러리는 추가하지 않아도 된다.

'저장소 > Qt' 카테고리의 다른 글

Style Sheet Syntax : Selector  (0) 2013.11.27
Qt Style Sheets (Qt 5.1)  (0) 2013.11.22
Drop Shadow Effect  (0) 2013.11.19
QImage, QPixmap의 loadFromData, bitmap image header, resource dll  (0) 2013.10.30
widget 프레임 제거와 배경 투명화  (0) 2013.10.30

Style Sheet Syntax : Selector

저장소/Qt


Qt Style Sheet로 이것저것 해보는 중에 차이가 잘 이해되지 않는 것

이것과
".QWidget {"
"background-color: rgba(0, 0, 0, 100%); }"
이것의
"QWidget {"
"background-color: rgba(0, 0, 0, 100%); }"
차이점은?

결론은 나만 적용할 것인가, 하위 위젯에도 동일하게 적용할 것인가의 차이.



Qt Centre에 아래 질문 올라옴.
http://www.qtcentre.org/threads/30221-Style-Sheet-Syntax-background
    Q: Style Sheet Syntax background


I want to have the background only from a QWidget black. The background from the QPushbuttons, QSliders etc. shoud be normal.

I use the Style-Syntax:


QWidget {

background-color:rgb(20, 20, 20);

}


I read in the Qt Assistant (Stylesheet-Syntax) that i must make bevore the QWidget a point:


.QWidget {

background-color:rgb(20, 20, 20);

}


I have now the problam that this didn't work. 


Thanks for help.



A:

well it works, but only for QWidgets! No subclass, even not your own if they only inherit QWidget.


maybe you provide a small executable example showing your problem.





The Style Sheet Syntax

http://qt-project.org/doc/qt-4.8/stylesheet-syntax.html

Selector Types

All the examples so far used the simplest type of selector, the Type Selector. Qt Style Sheets support all the selectors defined in CSS2. The table below summarizes the most useful types of selectors.

SelectorExampleExplanation
Universal Selector*Matches all widgets.
Type SelectorQPushButtonMatches instances of QPushButton and of its subclasses.
Property SelectorQPushButton[flat="false"]Matches instances of QPushButton that are not flat. You may use this selector to test for any Qt property that supports QVariant::toString() (see the toString()function documentation for details). In addition, the special class property is supported, for the name of the class.

This selector may also be used to test dynamic properties. For more information on customization using dynamic properties, refer toCustomizing Using Dynamic Properties.

Instead of =, you can also use ~= to test whether a Qt property of typeQStringList contains a given QString.

Warning: If the value of the Qt property changes after the style sheet has been set, it might be necessary to force a style sheet recomputation. One way to achieve this is to unset the style sheet and set it again.

Class Selector

.QPushButton

Matches instances of QPushButton, but not of its subclasses.

This is equivalent to *[class~="QPushButton"].

ID SelectorQPushButton#okButtonMatches all QPushButton instances whose object name is okButton.
Descendant SelectorQDialog QPushButtonMatches all instances of QPushButton that are descendants (children, grandchildren, etc.) of a QDialog.
Child SelectorQDialog > QPushButtonMatches all instances of QPushButton that are direct children of a QDialog.