/**
 * Setup the tab widget.
 * @param w
 */
void DTabbedMainWindow::setupTabWidget(QTabWidget *w)
{
    w->setFocusPolicy(Qt::NoFocus);

    if ( ! w->cornerWidget( Qt::TopRightCorner ) )
    {
        QToolButton *closeButton = new QToolButton(w);
        QPixmap closepx(16, 16);
        closepx.fill(Qt::transparent);

        QPainter p(&closepx);
        p.initFrom(this);

        p.setPen(QPen(palette().buttonText() , 4));
        p.drawLine(0, 0, 15,15);
        p.drawLine(0,15, 15, 0);


        p.end();

        closeButton->setIcon(closepx);
        closeButton->adjustSize();
        closeButton->hide();

        w->setCornerWidget(closeButton, Qt::TopRightCorner);

        connect(closeButton, SIGNAL(clicked()), this, SLOT(closeCurrentTab()));
    }

    connect(w, SIGNAL(currentChanged ( int)), this, SLOT(emitWidgetChanged( int )));
}
dtkSearchField::dtkSearchField(QWidget *parent) : QWidget(parent)
{
    QLineEdit *lineEdit = new QLineEdit(this);
    connect(lineEdit, SIGNAL(textChanged(QString)),
            this, SIGNAL(textChanged(QString)));
    connect(lineEdit, SIGNAL(editingFinished()),
            this, SIGNAL(editingFinished()));
    connect(lineEdit, SIGNAL(textChanged(QString)),
            this, SLOT(setText(QString)));

    QToolButton *clearButton = new QToolButton(this);
    QPixmap clearIcon(QString(":/Qocoa/qsearchfield_nonmac.png"));
    clearButton->setIcon(QIcon(clearIcon));
    clearButton->setIconSize(clearIcon.size());
    clearButton->setFixedSize(clearIcon.size());
    clearButton->setStyleSheet("border: none;");
    clearButton->hide();
    connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));

    d = new dtkSearchFieldPrivate(this, lineEdit, clearButton);

    lineEdit->setStyleSheet(QString("QLineEdit { padding-right: %1px; } ").arg(d->clearButtonPaddedWidth()));
    const int width = qMax(lineEdit->minimumSizeHint().width(), d->clearButtonPaddedWidth());
    const int height = qMax(lineEdit->minimumSizeHint().height(), d->clearButtonPaddedHeight());
    lineEdit->setMinimumSize(width, height);

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->setMargin(0);
    layout->addWidget(lineEdit);
}
Beispiel #3
0
QToolButton* PanIconWidget::button()
{
    QToolButton* btn = new QToolButton;
    btn->setToolButtonStyle(Qt::ToolButtonIconOnly);
    btn->setIcon(SmallIcon("transform-move"));
    btn->hide();
    btn->setToolTip( i18n("Pan the image to a region"));
    return btn;
}
Beispiel #4
0
bool StatusBar::load(CoreI *core) {
	menuMapper = new QSignalMapper(this);
	connect(menuMapper, SIGNAL(mapped(QObject *)), this, SLOT(actionTriggered(QObject *)));

	core_i = core;
	if((main_win_i = (MainWindowI *)core_i->get_interface(INAME_MAINWINDOW)) == 0) return false;
	if((icons_i = (IconsI *)core_i->get_interface(INAME_ICONS)) == 0) return false;
	if((accounts_i = (AccountsI *)core_i->get_interface(INAME_ACCOUNTS)) == 0) return false;
	if((menus_i = (MenusI *)core_i->get_interface(INAME_MENUS)) == 0) return false;

	if((events_i = (EventsI *)core_i->get_interface(INAME_EVENTS)) == 0) return false;
	events_i->add_event_listener(this, UUID_ACCOUNT_CHANGED);

	status_bar = new QStatusBar();
	main_win_i->set_status_bar(status_bar);

	toolbuttons = new QWidget(status_bar);
	toolbuttons->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
	toolButtonLayout = new QHBoxLayout(toolbuttons);
	toolButtonLayout->setSpacing(6);
	toolButtonLayout->setMargin(4);
	toolbuttons->setLayout(toolButtonLayout);
	status_bar->addWidget(toolbuttons);

	QToolButton *tb = new QToolButton();
	tb->setIcon(icons_i->get_icon("generic"));
	tb->setToolTip("Global Status");

	QMenu *menu = menus_i->get_menu("Global Status");
	//connect(proto, SIGNAL(local_status_change(const QString &, const QString &, GlobalStatus)) , this, SLOT(local_status_change(const QString &, const QString &, GlobalStatus)));
	each_contact_status(gs) {
		QAction *a = menus_i->add_menu_action("Global Status", hr_status_name[gs], status_name[gs]);
		a->setData(gs);
		connect(a, SIGNAL(triggered()), menuMapper, SLOT(map()));
		menuMapper->setMapping(a, a);
	}
	menus_i->add_menu_action("Global Status", "Global Status", "generic");
	menus_i->add_menu_separator("Global Status", menu->actions().at(1));

	tb->setMenu(menu);
	tb->setPopupMode(QToolButton::InstantPopup);
	tb->hide();
	status_bar->addPermanentWidget(tb);
	globalButton = tb;

	return true;
}
Beispiel #5
0
ManageBox::ManageBox(const QString & nameprefix, bool enable_clone, QWidget *parent)
            : QWidget(parent)
{

    namePrefix = nameprefix;
    // Management Buttons on the right top
    QHBoxLayout *manageBoxLayout = new QHBoxLayout;

    QToolButton *cloneButton = new QToolButton(this);
    if (enable_clone) {
        if (namePrefix.startsWith('S')) {
            cloneAction = new QAction(QIcon(seqwavcp_xpm), tr("&Clone..."), this);
        }
        else {
            cloneAction = new QAction(QIcon(lfowavcp_xpm), tr("&Clone..."), this);
        }
        cloneAction->setToolTip(tr("Duplicate this Module in muted state"));
        cloneButton->setDefaultAction(cloneAction);
        connect(cloneAction, SIGNAL(triggered()), this, SLOT(moduleClone()));
    }
    else cloneButton->hide();
    renameAction = new QAction(QIcon(arprename_xpm), tr("&Rename..."), this);
    renameAction->setToolTip(tr("Rename this Module"));
    QToolButton *renameButton = new QToolButton(this);
    renameButton->setDefaultAction(renameAction);
    connect(renameAction, SIGNAL(triggered()), this, SLOT(moduleRename()));

    deleteAction = new QAction(QIcon(arpremove_xpm), tr("&Delete..."), this);
    deleteAction->setToolTip(tr("Delete this Module"));
    QToolButton *deleteButton = new QToolButton(this);
    deleteButton->setDefaultAction(deleteAction);
    connect(deleteAction, SIGNAL(triggered()), this, SLOT(moduleDelete()));

    manageBoxLayout->addStretch();
    manageBoxLayout->addWidget(cloneButton);
    manageBoxLayout->addWidget(renameButton);
    manageBoxLayout->addWidget(deleteButton);

    setLayout(manageBoxLayout);
}