QuickLaunchButton::QuickLaunchButton(QuickLaunchAction * act, ILXQtPanelPlugin * plugin, QWidget * parent)
    : QToolButton(parent),
      mAct(act),
      mPlugin(plugin)
{
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    setAcceptDrops(true);
    setAutoRaise(true);

    setDefaultAction(mAct);
    mAct->setParent(this);

    mMoveLeftAct = new QAction(XdgIcon::fromTheme("go-previous"), tr("Move left"), this);
    connect(mMoveLeftAct, SIGNAL(triggered()), this, SIGNAL(movedLeft()));

    mMoveRightAct = new QAction(XdgIcon::fromTheme("go-next"), tr("Move right"), this);
    connect(mMoveRightAct, SIGNAL(triggered()), this, SIGNAL(movedRight()));


    mDeleteAct = new QAction(XdgIcon::fromTheme("dialog-close"), tr("Remove from quicklaunch"), this);
    connect(mDeleteAct, SIGNAL(triggered()), this, SLOT(selfRemove()));
    addAction(mDeleteAct);
    mMenu = new QMenu(this);
    mMenu->addAction(mAct);
    mMenu->addSeparator();
    mMenu->addAction(mMoveLeftAct);
    mMenu->addAction(mMoveRightAct);
    mMenu->addSeparator();
    mMenu->addAction(mDeleteAct);


    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
            this, SLOT(this_customContextMenuRequested(const QPoint&)));
}
Example #2
0
/*!
 * Constructs a file chooser with a given \a parent.
 * 
 */
QwwFileChooser::QwwFileChooser(QWidget *parent) : QwwButtonLineEdit(*new QwwFileChooserPrivate(this), parent) {
    Q_D(QwwFileChooser);
#if QT_VERSION >= 0x040200 && !defined(QT_NO_COMPLETER)
    d->completer = new QCompleter(this);
    setCompleter(d->completer);
    QStyleOption opt;
    opt.initFrom(this);
    int mar = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, &opt, this);
    int siz = style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, this);
#if QT_VERSION >=0x040500
    setTextMargins(siz+2, 0, 0, 0);
#else
    setStyleSheet(QString("QwwFileChooser {padding-left: %1px;}").arg(mar+siz+2));
#endif

//     connect(this, SIGNAL(textEdited(const QString&)), d->completer, SLOT(setCompletionPrefix(const QString&)));
#endif
    setModel(new QDirModel(this));
    setButtonPosition(RightOutside);
    connect(this, SIGNAL(buttonClicked()), this, SLOT(chooseFile()));
    setAutoRaise(true);
    setAcceptMode(QFileDialog::AcceptOpen);

    QShortcut *sc = new QShortcut(QKeySequence("Ctrl+Space"), this);
    connect(sc, SIGNAL(activated()), d->completer, SLOT(complete()));
    connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(_q_textChanged(const QString&)));
}
kpColorSimilarityToolBarItem::kpColorSimilarityToolBarItem (QWidget *parent)
    : QToolButton (parent),
      kpColorSimilarityHolder (),

      m_oldColorSimilarity (0),
      m_processedColorSimilarity (kpColor::Exact),
      m_flashTimer (new QTimer (this)),
      m_flashHighlight (0),
      m_suppressingFlashCounter (0)
{
    setAutoRaise (true);
    setFixedSize (52, 52);

    setWhatsThis (WhatsThisWithClickInstructions ());

    connect (this, SIGNAL (clicked ()), SLOT (openDialog ()));

    KConfigGroup cfg (KSharedConfig::openConfig (), kpSettingsGroupGeneral);
    setColorSimilarityInternal (cfg.readEntry (kpSettingColorSimilarity, 0.0),
        false/*don't write config*/);

    m_flashTimer->setInterval (100/*ms*/);
    connect (m_flashTimer, SIGNAL (timeout ()),
             SLOT (slotFlashTimerTimeout ()));
}
ToolButton::ToolButton(QString pic_name, QWidget *parent)
	:QToolButton(parent)
{
	//设置文本颜色
	QPalette text_palette = palette();
	text_palette.setColor(QPalette::ButtonText, QColor(230, 230, 230));
	setPalette(text_palette);

	//设置文本粗体
	QFont &text_font = const_cast<QFont &>(font());
	text_font.setWeight(QFont::Bold);

	setToolButtonStyle(Qt::ToolButtonTextUnderIcon);

	//设置图标
	QPixmap pixmap(pic_name);
	setIcon(pixmap);
	setIconSize(pixmap.size());

	//设置大小
	setFixedSize(pixmap.width()+25, pixmap.height()+25);
	setAutoRaise(true);
	setObjectName("transparentToolButton");

	mouse_over = false;
	mouse_press = false;
}
CustomToolButton::CustomToolButton(const QString& path, QWidget *parent)
	: QToolButton(parent), m_filePath(path)
{
	// Get the widget's palette, we do have to change the color of the tool button.
	QPalette text_palette = palette();
	text_palette.setColor(QPalette::ButtonText, QColor(230, 230, 230));
	setPalette(text_palette);
	// set the style of QToolButton.
	setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
	// set the font style of tool buttons
	// since the return value has the type of const, we have to remove the
	// constness if we want to modify.
	QFont text_font = const_cast<QFont&>(font());
	text_font.setBold(true);
	setFont(text_font);
	// set the fixed size for tool buttons.
	QPixmap background(m_filePath);
	setIcon(background);
	setIconSize(background.size());
	setFixedSize(background.width()+25, background.height()+25);

	setAutoRaise(true);
	m_mousePressed = false;
	m_mouseHover = false;
}
LocationEditor::LocationEditor(QWidget *parent) :
    QToolButton(parent)
{
    QPalette pal;
    pal.setColor(backgroundRole(), QPalette::Base);
    setPalette(pal);

    this->setFont(global.getGuiFont(font()));

    inactiveColor = "QToolButton {background-color: transparent; border-radius: 0px; border:none; margin 0px; padding: 4px} ";
    this->setCursor(Qt::PointingHandCursor);
    this->setStyleSheet(inactiveColor);

    defaultText = QString(tr("Click to set location..."));
    this->setText(defaultText);
    actionMenu = new QMenu();
    editAction = actionMenu->addAction(tr("Edit..."));
    clearAction = actionMenu->addAction(tr("Clear"));
    viewAction = actionMenu->addAction(tr("View on map"));
    connect(editAction, SIGNAL(triggered()), this, SLOT(buttonClicked()));
    connect(viewAction, SIGNAL(triggered()), this, SLOT(viewClicked()));
    connect(clearAction, SIGNAL(triggered()), this, SLOT(clearClicked()));
    setAutoRaise(false);
    setMenu(actionMenu);
    this->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    this->reloadIcons();
    connect(this, SIGNAL(clicked()), this, SLOT(buttonClicked()));

    hide();
}
static QToolButton *createButton(const QString& name, QWidget *parent, F& func) {
    auto b = new QToolButton(parent);
    b->setIcon(QIcon(QString(":/images/actions/%1.svg").arg(name)));
    b->setIconSize(QSize(22, 22));
    b->setAutoRaise(true);
    QObject::connect(b, &QToolButton::clicked, func);
    return b;
}
CQToolButton::
CQToolButton(const QIcon &icon) :
 QToolButton(0)
{
  setAutoRaise(true);

  setIcon(icon);
}
Example #9
0
void FlatButton::init()
{
	setUsesTextLabel(true);
	setUsesBigPixmap(true);
	setAutoRaise(true);
	setTextPosition( TQToolButton::Under );
	setFocusPolicy(TQ_StrongFocus);	
 }
KexiComboBoxDropDownButton::KexiComboBoxDropDownButton(QWidget *parent)
        : QToolButton(parent)
        , d(new Private)
{
    setAutoRaise(true);
    setArrowType(Qt::DownArrow);
    styleChanged();
}
Example #11
0
void ResourceDock::setupHTools() {
	auto htools = new QFrame(this);
	auto vlayout = new QVBoxLayout(htools);
	vlayout->setMargin(2);
	vlayout->setSpacing(0);

	auto hlayoutTitle = new QHBoxLayout();
	auto title = new QLabel(htools);
	title->setText("Resource Explorer ");
	title->setStyleSheet("color: lightGray;");
	hlayoutTitle->addWidget(title);

	auto sepBrush = QBrush(Qt::gray, Qt::BrushStyle::Dense6Pattern);
	QPalette sepPalette;
	sepPalette.setBrush(QPalette::Background, sepBrush);

	auto seprator = new QLabel(htools);
	seprator->setAutoFillBackground(true);
	seprator->setPalette(sepPalette);
	seprator->setMaximumHeight(10);
	hlayoutTitle->addWidget(seprator, 1, Qt::AlignBottom);

	auto btnClose = new QToolButton(htools);
	btnClose->setText("X");
	btnClose->setStyleSheet("color: lightGray\n");
	btnClose->setAutoRaise(true);
	btnClose->setMaximumWidth(16);
	btnClose->setMaximumHeight(16);
	hlayoutTitle->addWidget(btnClose);
	connect(btnClose, &QToolButton::clicked, this, &QDockWidget::hide);

	vlayout->addLayout(hlayoutTitle);
	vlayout->addSpacing(2);

	auto hlayoutTools = new QHBoxLayout();
	hlayoutTools->setMargin(0);
	hlayoutTools->setSpacing(0);

	auto btnCollAll = new QToolButton(htools);
	btnCollAll->setIcon(QIcon(":/icons/col"));
	btnCollAll->setToolTip("Collapse All");
	btnCollAll->setToolButtonStyle(Qt::ToolButtonIconOnly);
	connect(btnCollAll, &QToolButton::clicked, resTree, &QTreeWidget::collapseAll);
	hlayoutTools->addWidget(btnCollAll);
	hlayoutTools->addSpacing(5);

	auto ledit = new QLineEdit(htools);
	ledit->setPlaceholderText("Search");
	ledit->addAction(QIcon(":/icons/search"), QLineEdit::ActionPosition::TrailingPosition);
	ledit->setStyleSheet("background-color: gray;");
	connect(ledit, &QLineEdit::textChanged, this, &ResourceDock::searchAct);
	hlayoutTools->addWidget(ledit, 1);
	vlayout->addLayout(hlayoutTools);

	htools->setLayout(vlayout);

	setTitleBarWidget(htools);
}
Button::Button(QWidget *parent)
  :QToolButton(parent)
{
  setAutoRaise(true);
  QPalette p = palette();
  p.setColor(QPalette::Button, Qt::transparent);
  setPalette(p);
  setFocusPolicy(Qt::NoFocus);
}
Example #13
0
MenuButton::MenuButton(QWidget *parent) :
    QToolButton(parent)
{
    setAutoRaise(true);
    setPopupMode(QToolButton::InstantPopup);
    setFocusPolicy(Qt::NoFocus);
    setStyleSheet("QToolButton::menu-indicator { image: none; }");
    setIcon(APP_ICON("menu"));
}
Example #14
0
KviScriptUserButton::KviScriptUserButton(QWidget * par,const char * name)
: QToolButton(par)
{
	m_pScript = 0;
	setObjectName(name);
//	setAutoRaise(true);
	connect(this,SIGNAL(clicked()),this,SLOT(btnClicked()));
	setAutoRaise(true);
}
Example #15
0
ArgBoolWidget::ArgBoolWidget(QWidget* parent) 
 : QToolButton(parent)
{
  setAutoRaise(true);
  setCheckable(true);
  setText("FALSE");
  setMinimumWidth(70);
  QObject::connect(this, SIGNAL(toggled(bool)), SLOT(updateButtonText(bool)) );
}
Example #16
0
ComboToolButton::ComboToolButton(QWidget *parent) : QToolButton(parent) {
    setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    setPopupMode(QToolButton::MenuButtonPopup);
    setAutoRaise(true);

    connect(this,SIGNAL(triggered(QAction *)),this,SLOT(onMenuSelected(QAction *)));

    isFirstTime = true;
    curr_action = NULL;
}
Example #17
0
ToolButton_Impl::ToolButton_Impl()
	: QToolButton(), WidgetInterface(), fFlat(false)
{
	setPopupMode(InstantPopup);
	setAutoRaise(true);
	
	connect(this, SIGNAL(clicked()), this, SLOT(handleClicked()), Qt::QueuedConnection);
	connect(this, SIGNAL(toggled(bool)), this, SLOT(handleToggled(bool)));
	connect(SL_QAPP(), SIGNAL(endDrag(QObject *)), this, SLOT(handleEndDrag(QObject *)));
}
Example #18
0
SoundButton::SoundButton(QWidget *parent)
  : QToolButton(parent)
  , m_mute(ChatAlerts::isMute())
{
  setAutoRaise(true);
  setMute(m_mute);

  connect(this, SIGNAL(clicked(bool)), SLOT(clicked()));
  connect(ChatCore::settings(), SIGNAL(changed(QString,QVariant)), SLOT(settingsChanged(QString,QVariant)));
}
Example #19
0
SGraphicStackItem::SGraphicStackItem( const QString & text , QWidget *parent )
    : QToolButton( parent )
{
    setText( text );
    setAutoRaise( true );
    setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
    setCheckable( true );
    setFixedHeight( 28 );
    //setFixedWidth( 73 );
    connect( this , SIGNAL(clicked()) , SLOT(click_on()) );
}
Example #20
0
KoContextBarButton::KoContextBarButton(const QString &iconName, QWidget* parent)
: QToolButton(parent)
, m_isHovered(false)
, m_fadingValue(0)
, m_fadingTimeLine(0)
{
    const int size = IconSize(KIconLoader::Small);
    setIconSize(QSize(size, size));
    setAutoRaise(true);
    setIcon(QIcon::fromTheme(iconName));
}
Example #21
0
QgsRatioLockButton::QgsRatioLockButton( QWidget *parent )
  : QToolButton( parent )


{
  setMinimumSize( QSize( 24, 24 ) );
  setMaximumWidth( fontMetrics().width( QStringLiteral( "000" ) ) );
  setCheckable( true );
  setAutoRaise( true );
  connect( this, &QPushButton::clicked, this, &QgsRatioLockButton::buttonClicked );
}
Example #22
0
QT_BEGIN_NAMESPACE

QToolBarExtension::QToolBarExtension(QWidget *parent)
    : QToolButton(parent)
{
    setObjectName(QLatin1String("qt_toolbar_ext_button"));
    setAutoRaise(true);
    setOrientation(Qt::Horizontal);
    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    setCheckable(true);
}
Example #23
0
KoContextBarButton::KoContextBarButton(const QString &iconName, QWidget* parent)
: QToolButton(parent)
, m_isHovered(false)
, m_fadingValue(0)
, m_fadingTimeLine(0)
{
    const int size = QApplication::style()->pixelMetric(QStyle::PM_ButtonIconSize);
    setIconSize(QSize(size, size));
    setAutoRaise(true);
    setIcon(QIcon::fromTheme(iconName));
}
Example #24
0
// Моя кнопка для навигатора 
NavigatorButton::NavigatorButton( const QString & text, const QIcon & icon , QWidget *parent )
    : QToolButton( parent )
{
  setText( text );
  setIcon( icon );
  setFocusPolicy( Qt::NoFocus );
  setCheckable( true );
  setAutoRaise( true );
  setToolButtonStyle ( Qt::ToolButtonTextBesideIcon );
  setMinimumSize(QSize( NButtonWidth , 0));
}
Example #25
0
ExpandButton::ExpandButton(QWidget* parent)
: QToolButton(parent)
, _expandDirection(ED_Down) {
	setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	
	// Set icon, so that QToolButton::sizeHint().width() is correct
	QPixmap pix(":/pics/expand_button/right.png");
	setIcon(pix);

	setAutoRaise(true);
	setCheckable(true);
}
Example #26
0
File: options.cpp Project: KDE/kwin
void Options::setFocusPolicy(FocusPolicy focusPolicy)
{
    if (m_focusPolicy == focusPolicy) {
        return;
    }
    m_focusPolicy = focusPolicy;
    emit focusPolicyChanged();
    if (m_focusPolicy == ClickToFocus) {
        setAutoRaise(false);
        setAutoRaiseInterval(0);
        setDelayFocusInterval(0);
    }
}
Example #27
0
IconButton::IconButton(QWidget *parent)
    : QToolButton(parent)
{
    setFocusPolicy(Qt::NoFocus);
    //setToolButtonStyle(Qt::ToolButtonIconOnly);
    setStyleSheet("QToolButton { background-color:transparent; border: none; padding: 0px}");
    setCursor(Qt::ArrowCursor);
    setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );

    setContextMenuPolicy(Qt::PreventContextMenu);
    setAutoRaise(true);
    setPopupMode (QToolButton::InstantPopup); 
    setArrowType( Qt::NoArrow);
}
Example #28
0
KviWindowToolPageButton::KviWindowToolPageButton(KviIconManager::SmallIcon eIconOff, KviIconManager::SmallIcon eIconOn, const QString & szText, QWidget * pParent, bool bOn)
    :QToolButton(pParent)
{
    setAutoRaise(true);
    setToolTip(szText);
    setObjectName("kvi_window_tool_button");
    QIcon icon;
    icon.addPixmap(*(g_pIconManager->getSmallIcon(eIconOff)),QIcon::Normal,QIcon::Off);
    icon.addPixmap(*(g_pIconManager->getSmallIcon(eIconOn)),QIcon::Active,QIcon::On);
    icon.addPixmap(*(g_pIconManager->getSmallIcon(eIconOn)),QIcon::Active);
    setIcon(icon);
    setCheckable(true);
    setChecked(bOn);
}
Example #29
0
void KFocusConfig::load( void )
{
    QString key;

    KConfigGroup cg(config, "Windows");

    key = cg.readEntry(KWIN_FOCUS);
    if( key == "ClickToFocus")
        setFocus(CLICK_TO_FOCUS);
    else if( key == "FocusFollowsMouse")
        setFocus(FOCUS_FOLLOWS_MOUSE);
    else if(key == "FocusUnderMouse")
        setFocus(FOCUS_UNDER_MOUSE);
    else if(key == "FocusStrictlyUnderMouse")
        setFocus(FOCUS_STRICTLY_UNDER_MOUSE);

    int k = cg.readEntry(KWIN_AUTORAISE_INTERVAL,750);
    setAutoRaiseInterval(k);

    k = cg.readEntry(KWIN_DELAYFOCUS_INTERVAL,750);
    setDelayFocusInterval(k);

    setAutoRaise( cg.readEntry(KWIN_AUTORAISE, false));
    setDelayFocus( cg.readEntry(KWIN_DELAYFOCUS, false));
    setClickRaise( cg.readEntry(KWIN_CLICKRAISE, true));
    focusPolicyChanged();      // this will disable/hide the auto raise delay widget if focus==click
    setDelayFocusEnabled();

    setSeparateScreenFocus( cg.readEntry(KWIN_SEPARATE_SCREEN_FOCUS, false));
    // on by default for non click to focus policies
    setActiveMouseScreen( cg.readEntry(KWIN_ACTIVE_MOUSE_SCREEN, focusCombo->currentIndex() != 0 ));

    key = cg.readEntry(KWIN_ALTTABMODE, "KDE");
    setAltTabMode(key == "KDE");

    setRollOverDesktops( cg.readEntry(KWIN_ROLL_OVER_DESKTOPS, true));

    setShowPopupinfo( config->group("PopupInfo").readEntry(KWIN_SHOW_POPUP, false));

    setTraverseAll( config->group("TabBox").readEntry(KWIN_TRAVERSE_ALL, false));


//    setFocusStealing( cg.readEntry(KWIN_FOCUS_STEALING, 2 ));
    // TODO default to low for now
    setFocusStealing( cg.readEntry(KWIN_FOCUS_STEALING, 1 ));

    emit KCModule::changed(false);
}
Example #30
0
QToolButton::QToolButton( QWidget * parent, const char *name )
    : QButton( parent, name )
{
    init();
#ifndef QT_NO_TOOLBAR
    if ( parent && parent->inherits( "QToolBar" ) ) {
	setAutoRaise( TRUE );
	QToolBar* tb = (QToolBar*)parent;
	if ( tb->mainWindow() ) {
	    connect( tb->mainWindow(), SIGNAL(pixmapSizeChanged(bool)),
	             this, SLOT(setUsesBigPixmap(bool)) );
	    setUsesBigPixmap( tb->mainWindow()->usesBigPixmaps() );
	    connect( tb->mainWindow(), SIGNAL(usesTextLabelChanged(bool)),
	             this, SLOT(setUsesTextLabel(bool)) );
	    setUsesTextLabel( tb->mainWindow()->usesTextLabel() );
	} else {