Exemplo n.º 1
0
TDEActionSelector::TDEActionSelector( TQWidget *parent, const char *name )
  : TQWidget( parent, name )
{
  d = new TDEActionSelectorPrivate();
  d->moveOnDoubleClick = true;
  d->keyboardEnabled = true;
  d->iconSize = SmallIcon;
  d->addIcon = TQApplication::reverseLayout()? "back" : "forward";
  d->removeIcon = TQApplication::reverseLayout()? "forward" : "back";
  d->upIcon = "up";
  d->downIcon = "down";
  d->availableInsertionPolicy = Sorted;
  d->selectedInsertionPolicy = BelowCurrent;
  d->showUpDownButtons = true;

  //int isz = IconSize( TDEIcon::Small );

  TQHBoxLayout *lo = new TQHBoxLayout( this );
  lo->setSpacing( KDialog::spacingHint() );

  TQVBoxLayout *loAv = new TQVBoxLayout( lo );
  d->lAvailable = new TQLabel( i18n("&Available:"), this );
  loAv->addWidget( d->lAvailable );
  d->availableListBox = new TQListBox( this );
  loAv->addWidget( d->availableListBox );
  d->lAvailable->setBuddy( d->availableListBox );

  TQVBoxLayout *loHBtns = new TQVBoxLayout( lo );
  loHBtns->addStretch( 1 );
  d->btnAdd = new TQToolButton( this );
  loHBtns->addWidget( d->btnAdd );
  d->btnRemove = new TQToolButton( this );
  loHBtns->addWidget( d->btnRemove );
  loHBtns->addStretch( 1 );

  TQVBoxLayout *loS = new TQVBoxLayout( lo );
  d->lSelected = new TQLabel( i18n("&Selected:"), this );
  loS->addWidget( d->lSelected );
  d->selectedListBox = new TQListBox( this );
  loS->addWidget( d->selectedListBox );
  d->lSelected->setBuddy( d->selectedListBox );

  TQVBoxLayout *loVBtns = new TQVBoxLayout( lo );
  loVBtns->addStretch( 1 );
  d->btnUp = new TQToolButton( this );
  d->btnUp->setAutoRepeat( true );
  loVBtns->addWidget( d->btnUp );
  d->btnDown = new TQToolButton( this );
  d->btnDown->setAutoRepeat( true );
  loVBtns->addWidget( d->btnDown );
  loVBtns->addStretch( 1 );

  loadIcons();

  connect( d->btnAdd, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonAddClicked()) );
  connect( d->btnRemove, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonRemoveClicked()) );
  connect( d->btnUp, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonUpClicked()) );
  connect( d->btnDown, TQT_SIGNAL(clicked()), this, TQT_SLOT(buttonDownClicked()) );
  connect( d->availableListBox, TQT_SIGNAL(doubleClicked(TQListBoxItem*)),
           this, TQT_SLOT(itemDoubleClicked(TQListBoxItem*)) );
  connect( d->selectedListBox, TQT_SIGNAL(doubleClicked(TQListBoxItem*)),
           this, TQT_SLOT(itemDoubleClicked(TQListBoxItem*)) );
  connect( d->availableListBox, TQT_SIGNAL(currentChanged(TQListBoxItem*)),
           this, TQT_SLOT(slotCurrentChanged(TQListBoxItem *)) );
  connect( d->selectedListBox, TQT_SIGNAL(currentChanged(TQListBoxItem*)),
           this, TQT_SLOT(slotCurrentChanged(TQListBoxItem *)) );

  d->availableListBox->installEventFilter( this );
  d->selectedListBox->installEventFilter( this );
}
Exemplo n.º 2
0
    int index = 0;
    foreach(toolbar, toolbars) {
        index = (int)(toolbar->iconSize().height()/10)-1;
        if (toolbar->objectName() != "keyToolBar")
            comboToolbars->addItem(toolbar->windowTitle(), QVariant::fromValue((QObject*)toolbar));
    }
    comboToolbarsCurrentIndexChanged(0);

    QMainWindow *mwParent = qobject_cast<QMainWindow*>(parent);

    comboButtonStyle->setCurrentIndex(int(mwParent->toolButtonStyle()));
    comboIconSize->setCurrentIndex(index);
    connect(buttonUp, SIGNAL(clicked()), this, SLOT(buttonUpClicked()));
    connect(buttonDown, SIGNAL(clicked()), this, SLOT(buttonDownClicked()));
    connect(buttonAdd, SIGNAL(clicked()), this, SLOT(buttonAddClicked()));
    connect(buttonRemove, SIGNAL(clicked()), this, SLOT(buttonRemoveClicked()));
    connect(comboToolbars, SIGNAL(currentIndexChanged(int)), this, SLOT(comboToolbarsCurrentIndexChanged(int)));
    connect(comboIconSize, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(comboIconSizeCurrentIndexChanged(const QString &)));
    connect(comboButtonStyle, SIGNAL(currentIndexChanged(int)),this, SLOT(comboButtonStyleCurrentIndexChanged(int)));
    connect(buttonDefault, SIGNAL(clicked()), this, SLOT(restoreDefaultToolbars()));
}

ToolbarDialog::~ToolbarDialog()
{
}

void ToolbarDialog::buttonAddClicked()
{
    // get the target toolar
    QVariant v;
    v = comboToolbars->itemData(comboToolbars->currentIndex());