QWidget * AnnotationWidget::createAppearanceWidget() { QWidget * widget = new QWidget(); QGridLayout * gridlayout = new QGridLayout( widget ); QLabel * tmplabel = new QLabel( i18n( "&Color:" ), widget ); gridlayout->addWidget( tmplabel, 0, 0, Qt::AlignRight ); m_colorBn = new KColorButton( widget ); m_colorBn->setColor( m_ann->style().color() ); tmplabel->setBuddy( m_colorBn ); gridlayout->addWidget( m_colorBn, 0, 1 ); tmplabel = new QLabel( i18n( "&Opacity:" ), widget ); gridlayout->addWidget( tmplabel, 1, 0, Qt::AlignRight ); m_opacity = new KIntNumInput( widget ); m_opacity->setRange( 0, 100 ); m_opacity->setValue( (int)( m_ann->style().opacity() * 100 ) ); m_opacity->setSuffix( i18nc( "Suffix for the opacity level, eg '80 %'", " %" ) ); tmplabel->setBuddy( m_opacity ); gridlayout->addWidget( m_opacity, 1, 1 ); QWidget * styleWidget = createStyleWidget(); if ( styleWidget ) gridlayout->addWidget( styleWidget, 2, 0, 1, 2 ); gridlayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ), 3, 0 ); connect( m_colorBn, SIGNAL(changed(QColor)), this, SIGNAL(dataChanged()) ); connect( m_opacity, SIGNAL(valueChanged(int)), this, SIGNAL(dataChanged()) ); return widget; }
QWidget * AnnotationWidget::styleWidget() { if ( m_styleWidget ) return m_styleWidget; m_styleWidget = createStyleWidget(); return m_styleWidget; }