Logo Search packages:      
Sourcecode: basket version File versions  Download package

LinkLookEditWidget::LinkLookEditWidget ( LinkLook look,
const QString  exTitle,
const QString  exIcon,
QWidget *  parent = 0,
const char *  name = 0,
WFlags  fl = 0 
)

LinkLookEditWidget

Definition at line 338 of file linklabel.cpp.

References LinkLook::bold(), LinkLook::color(), LinkLook::hoverColor(), LinkLook::hoverUnder(), LinkLook::iconSize(), LinkLook::italic(), LinkLook::onTopIcon(), IconSizeCombo::setSize(), LinkLook::showIcon(), and LinkLook::underline().

 : QWidget(parent, name, fl)
{
      QLabel      *label;
      QVBoxLayout *layout = new QVBoxLayout(this, 8, 6);

      m_look = look;

      m_italic = new QCheckBox(i18n("I&talic"), this);
      m_italic->setChecked(look->italic());
      layout->addWidget(m_italic);

      m_bold = new QCheckBox(i18n("&Bold"), this);
      m_bold->setChecked(look->bold());
      layout->addWidget(m_bold);

      QGridLayout *gl = new QGridLayout(layout, 4, 3);
      gl->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding), 1, 2);

      m_underline = new QComboBox(false, this);
      m_underline->insertItem(i18n("Always"));
      m_underline->insertItem(i18n("Never"));
      m_underline->insertItem(i18n("On mouse hovering"));
      m_underline->insertItem(i18n("When mouse is outside"));
      m_underline->setCurrentItem( look->underline() ? (look->hoverUnder()?3:0) : (look->hoverUnder()?2:1) );
      label = new QLabel(m_underline, i18n("&Underline:"), this);
      gl->addWidget(label,       0, 0);
      gl->addWidget(m_underline, 0, 1);

      m_color = new KColorButton(this);
      m_color->setColor(look->color());
      label = new QLabel(m_color, i18n("Colo&r:"), this);
      gl->addWidget(label,   1, 0);
      gl->addWidget(m_color, 1, 1);

      m_hoverColor = new KColorButton(this);
      m_hoverColor->setColor(look->hoverColor());
      label = new QLabel(m_hoverColor, i18n("&Mouse hover color:"), this);
      gl->addWidget(label,        2, 0);
      gl->addWidget(m_hoverColor, 2, 1);

      QHBoxLayout *icoLay = new QHBoxLayout(0L, 0, 6);
      m_onTopIcon = new QComboBox(false, this);
      m_onTopIcon->insertItem(i18n("No icon", "None"));
      m_onTopIcon->insertItem(i18n("On side"));
      m_onTopIcon->insertItem(i18n("On top"));
      if ( ! look->showIcon() )
            m_onTopIcon->setCurrentItem(0);
      else
            m_onTopIcon->setCurrentItem(look->onTopIcon() + 1);
      m_iconSize = new IconSizeCombo(false, this);
      m_iconSize->setSize(look->iconSize());
      icoLay->addWidget(m_onTopIcon);
      icoLay->addWidget(m_iconSize);
      label = new QLabel(m_onTopIcon, i18n("&Icon:"), this);
      gl->addWidget(label,  3, 0);
      gl->addItem(  icoLay, 3, 1);

      QGroupBox *gb = new QHGroupBox(i18n("Example"), this);
      m_exLook = new LinkLook(*look);
      m_example = new LinkLabel(exTitle, exIcon, m_exLook, 1, 1, gb);
      m_example->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
      m_example->setCursor(QCursor(Qt::PointingHandCursor));
      layout->addWidget(gb);
      m_exTitle = exTitle;
      m_exIcon  = exIcon;

      slotChangeLook();

      connect( m_underline,  SIGNAL(activated(int)),         this, SLOT(slotChangeLook())              );
      connect( m_italic,     SIGNAL(clicked()),              this, SLOT(slotChangeLook())              );
      connect( m_bold,       SIGNAL(clicked()),              this, SLOT(slotChangeLook())              );
      connect( m_color,      SIGNAL(changed(const QColor&)), this, SLOT(slotChangeLook(const QColor&)) );
      connect( m_hoverColor, SIGNAL(changed(const QColor&)), this, SLOT(slotChangeLook(const QColor&)) );
      connect( m_onTopIcon,  SIGNAL(activated(int)),         this, SLOT(slotChangeLook(int))           );
      connect( m_iconSize,   SIGNAL(activated(int)),         this, SLOT(slotChangeLook(int))           );
}


Generated by  Doxygen 1.6.0   Back to index