검색결과 리스트
2018/09에 해당되는 글 3건
- 2018.09.27 draw filled ellipse by QPainter at QT
- 2018.09.20 C++에서의 default 인자 주기
- 2018.09.11 enum to QString , QString to enum, enum 순회
just simple
example function : drawFooterArea(QPainter *painter, const QRect& rect, const QSqlRecord& record) const
1 set pen / brush the color you want
painter->setPen(Qt::red);
painter->setBrush(Qt::red);
2. draw Ellipse
painter->drawEllipse(rect);
if you don't set brush, just show circle line
함수 선언을..
void error(char const *msg, bool showKind = true, bool exit);
이런 식으로 하면 다음과 같은 애러가 뜨게 된다.
default argument not at end of parameter list
이것의 의미는 끝에 기본 값을 안 줬다 이며 이것을 해결하기 위해서는
끝에서부터 기본값을 주기 시작해야 한다는 의미이다.
exit도 기본 값을 주던지 아니면 showKind를 제일 뒤로 보내야 한다~
더 자세한 설명은 https://stackoverflow.com/questions/5637679/default-argument-in-the-middle-of-parameter-list
enum 정의를 해서 사용하는데
그 정의가 늘어날 때마다 관련 코드를 넣는 것은 매우 고통스러운 일이다.
그리고 enum 실제 값과 해당하는 enum을 찾아서 처리해야하는 일들이 생긴다.
그 럴 때 사용하는 것이 QMetaEnum( 관련 문서 : http://doc.qt.io/qt-5/qmetaenum.html )이다.
예제.
#2 enum to QString
Currency::CurrencyType tempType = currency;
QString currencyString = QVariant::fromValue(currency).value<QString>();
RECENT COMMENT