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

BasketPropertiesWidget::BasketPropertiesWidget ( Basket basket,
QWidget *  parent = 0,
const char *  name = 0 
)

BasketPropertiesWidget

Definition at line 47 of file basketproperties.cpp.

References Basket::altColor(), Basket::color(), Basket::hAlign(), Basket::icon(), Basket::showCheckBoxes(), and Basket::vAlign().

 : QWidget(parent, name)
{
      QHBoxLayout *hLay;
      QLabel      *label;

      m_basket = basket;
      QVBoxLayout *vLay = new QVBoxLayout(this, 0, 6);
      QGridLayout *gl   = new QGridLayout(vLay, 5, 3);
      gl->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding), 1, 2);

      m_name = new QLineEdit(m_basket->name(), this);
      label  = new QLabel(m_name, i18n("&Name:"), this);
      gl->addWidget(         label,  0, 0);
      gl->addMultiCellWidget(m_name, 0, 0, 1, 2);

      hLay   = new QHBoxLayout(0L, 0, 6);
      m_icon = new KIconButton(this);
      label  = new QLabel(m_icon, i18n("&Icon:"), this);
      m_icon->setIconType (KIcon::Small, KIcon::Any);
      QPushButton *button = new QPushButton(i18n("Cl&ear"), this); // Create before to know size here:
      connect( button, SIGNAL(pressed()), this, SLOT(emptyIcon()) );
      // BEGIN Icon button
      m_icon->setIcon(basket->icon());
      int minSize = button->sizeHint().height();
      // Make the icon button at least the same heigh than the other buttons for a better alignment (nicer to the eyes):
      if (m_icon->sizeHint().height() < minSize)
            m_icon->setFixedSize(minSize, minSize);
      else
            m_icon->setFixedSize(m_icon->sizeHint().height(), m_icon->sizeHint().height()); // Make it square
      if ( basket->icon().isEmpty() )
            m_icon->resetIcon();
      // END
      hLay->addWidget(m_icon);
      hLay->addWidget(button);
      gl->addWidget(label, 1, 0);
      gl->addItem(  hLay,  1, 1);

      m_color = new KColorButton(basket->color(), this);
      label   = new QLabel(m_color, i18n("&Background color:"), this);
      gl->addWidget(label,   2, 0);
      gl->addWidget(m_color, 2, 1);

      m_altColor = new KColorButton(basket->altColor(), this);
      label      = new QLabel(m_altColor, i18n("Alte&rnate background color:"), this);
      gl->addWidget(label,      3, 0);
      gl->addWidget(m_altColor, 3, 1);

      hLay = new QHBoxLayout(0L, 0, 6);
      m_hAlign = new QComboBox(this);
      label = new QLabel(m_hAlign, i18n("Items ali&gnment:"), this);
      m_hAlign->insertItem(i18n("Left"));
      m_hAlign->insertItem(i18n("Center"));
      m_hAlign->insertItem(i18n("Right"));
      m_hAlign->setCurrentItem(basket->hAlign());
      m_vAlign = new QComboBox(this);
      m_vAlign->insertItem(i18n("Top"));
      m_vAlign->insertItem(i18n("Middle"));
      m_vAlign->insertItem(i18n("Bottom"));
      m_vAlign->setCurrentItem(basket->vAlign());
      hLay->addWidget(m_hAlign);
      hLay->addWidget(m_vAlign);
      gl->addWidget(label, 4, 0);
      gl->addItem(  hLay,  4, 1);

      m_showCheckBoxes = new QCheckBox(i18n("Show items chec&k boxes"), this);
      m_showCheckBoxes->setChecked(basket->showCheckBoxes());
      vLay->addWidget(m_showCheckBoxes);

      vLay->addStretch();

      // Temporary useless option:
      m_vAlign->hide();

      m_name->setFocus();
}


Generated by  Doxygen 1.6.0   Back to index