QTfrontend/igbox.cpp
changeset 1248 8c77eec56bf4
parent 1209 7f6cb1d7be2a
child 1424 2b45d88716b0
equal deleted inserted replaced
1247:890b6741251d 1248:8c77eec56bf4
    23 
    23 
    24 #include "igbox.h"
    24 #include "igbox.h"
    25 
    25 
    26 IconedGroupBox::IconedGroupBox(QWidget * parent)
    26 IconedGroupBox::IconedGroupBox(QWidget * parent)
    27 {
    27 {
    28 
    28 	padding = 82;
    29 }
    29 }
    30 
    30 
    31 void IconedGroupBox::setIcon(const QIcon & icon)
    31 void IconedGroupBox::setIcon(const QIcon & icon)
    32 {
    32 {
    33 	this->icon = icon;
    33 	this->icon = icon;
    34 	setStyleSheet(
    34 	setStyleSheet(QString(
    35 		"IconedGroupBox{"
    35 		"IconedGroupBox{"
    36 			"margin-top: 46px;"
    36 			"margin-top: 46px;"
    37 			"margin-left: 12px;"
    37 			"margin-left: 12px;"
    38 			"padding-top: 22px;"
    38 			"padding: 22px 0px 0px 0px;"
    39 			"}"
    39 			"}"
    40 		"IconedGroupBox::title{"
    40 		"IconedGroupBox::title{"
    41 			"subcontrol-origin: margin;"
    41 			"subcontrol-origin: margin;"
    42 			"subcontrol-position: top left;"
    42 			"subcontrol-position: top left;"
    43 			"padding-left: 82px;"
    43 			"padding-left: %1px;"
    44 			"padding-top: 26px;"
    44 			"padding-top: 26px;"
    45 			"text-align: left;"
    45 			"text-align: left;"
    46 			"}"
    46 			"}"
       
    47 			).arg(padding)
    47 	);
    48 	);
    48 }
    49 }
    49 
    50 
    50 void IconedGroupBox::paintEvent(QPaintEvent * event)
    51 void IconedGroupBox::paintEvent(QPaintEvent * event)
    51 {
    52 {
    55 	initStyleOption(&option);
    56 	initStyleOption(&option);
    56 	painter.drawComplexControl(QStyle::CC_GroupBox, option);
    57 	painter.drawComplexControl(QStyle::CC_GroupBox, option);
    57 
    58 
    58 	icon.paint(&painter, QRect(QPoint(0, 0), icon.actualSize(size())));
    59 	icon.paint(&painter, QRect(QPoint(0, 0), icon.actualSize(size())));
    59 }
    60 }
       
    61 
       
    62 void IconedGroupBox::setTitleTextPadding(int px)
       
    63 {
       
    64 	padding = px;
       
    65 }