Пример #1
0
void MyColorButton::UpdateColor()
{
	GetDefault();
	QColor color(currentValue.R / 256, currentValue.G / 256, currentValue.B / 256);
	painter->fillRect(QRect(0, 0, w, h), color);
	painter->drawRect(0,0,w-1,h-1);

	if(!(defaultValue.R / 256 == currentValue.R / 256 && defaultValue.G / 256 == currentValue.G / 256 && defaultValue.B / 256 == currentValue.B / 256))
	{
		// not (almost) default color -> make border thicker to indicate non default value
		painter->drawRect(1,1,w-3,h-3);
	}

	QIcon icon(*pix);
	setIcon(icon);
	setIconSize(QSize(w, h));
}
Пример #2
0
void KoColorPopupButton::resizeEvent(QResizeEvent *e)
{
    QStyleOptionToolButton opt;
    initStyleOption(&opt);
    QSize size = iconSize();

    QSize rect = style()->sizeFromContents(QStyle::CT_ToolButton, &opt, size, this);
    int iconWidth = size.width() - rect.width() + e->size().width();

    if (iconWidth != size.width()) {
        size.setWidth(iconWidth);
        setIconSize(size);
    }
    QToolButton::resizeEvent(e);

    emit iconSizeChanged();
}
Пример #3
0
TabSupervisor::TabSupervisor(AbstractClient *_client, QWidget *parent)
    : QTabWidget(parent), userInfo(0), client(_client), tabServer(0), tabUserLists(0), tabDeckStorage(0), tabReplays(0), tabAdmin(0), tabLog(0)
{
    setElideMode(Qt::ElideRight);
    setMovable(true);
    setIconSize(QSize(15, 15));
    connect(this, SIGNAL(currentChanged(int)), this, SLOT(updateCurrent(int)));

    connect(client, SIGNAL(roomEventReceived(const RoomEvent &)), this, SLOT(processRoomEvent(const RoomEvent &)));
    connect(client, SIGNAL(gameEventContainerReceived(const GameEventContainer &)), this, SLOT(processGameEventContainer(const GameEventContainer &)));
    connect(client, SIGNAL(gameJoinedEventReceived(const Event_GameJoined &)), this, SLOT(gameJoined(const Event_GameJoined &)));
    connect(client, SIGNAL(userMessageEventReceived(const Event_UserMessage &)), this, SLOT(processUserMessageEvent(const Event_UserMessage &)));
    connect(client, SIGNAL(maxPingTime(int, int)), this, SLOT(updatePingTime(int, int)));
    connect(client, SIGNAL(notifyUserEventReceived(const Event_NotifyUser &)), this, SLOT(processNotifyUserEvent(const Event_NotifyUser &)));
    
    retranslateUi();
}
Пример #4
0
PlayerListWidget::PlayerListWidget(QWidget *parent)
	: QTreeWidget(parent), gameStarted(false)
{
	readyIcon = QIcon(":/resources/icon_ready_start.svg");
	notReadyIcon = QIcon(":/resources/icon_not_ready_start.svg");
	concededIcon = QIcon(":/resources/icon_conceded.svg");
	playerIcon = QIcon(":/resources/icon_player.svg");
	spectatorIcon = QIcon(":/resources/icon_spectator.svg");

	setMinimumHeight(100);
	setIconSize(QSize(20, 15));
	setColumnCount(6);
	setRootIsDecorated(false);
	setSelectionMode(NoSelection);
	header()->setResizeMode(QHeaderView::ResizeToContents);
	retranslateUi();
}
Пример #5
0
SymbolView::SymbolView(QWidget* parent) : QListWidget(parent)
{
	setDragEnabled(true);
	setViewMode(QListView::IconMode);
	setFlow(QListView::LeftToRight);
	setSortingEnabled(true);
	setWrapping(true);
	setAcceptDrops(true);
	setDropIndicatorShown(true);
	setDragDropMode(QAbstractItemView::DragDrop);
	setResizeMode(QListView::Adjust);
	setSelectionMode(QAbstractItemView::SingleSelection);
	setContextMenuPolicy(Qt::CustomContextMenu);
	delegate = new ScListWidgetDelegate(this, this);
	setItemDelegate(delegate);
	setIconSize(QSize(48, 48));
	connect(this, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleContextMenu(QPoint)));
}
Пример #6
0
ToolBar::ToolBar(QWidget* parent) : QToolBar(parent)
{
	setIconSize(QSize(24, 24));
	setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);

	addAction(QIcon(":/Resource/Generic/Settings.png"), "", this, SIGNAL(settingsTriggered()))->setToolTip(tr("Settings"));

	QWidget* spacer = new QWidget(this);
	spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	addWidget(spacer);

	addAction(QIcon(":/Resource/Network/Connect.png"), "", this, SIGNAL(connectTriggered()))->setToolTip(tr("Connect"));
	addAction(QIcon(":/Resource/Generic/Add.png"), "", this, SIGNAL(joinTriggered()))->setToolTip(tr("Add view"));

	QLineEdit lineEdit;
	lineEdit.setStyleSheet("QLineEdit { border: 1px solid transparent; }");
	setFixedHeight(28);
}
Пример #7
0
QgsMultiEditToolButton::QgsMultiEditToolButton( QWidget *parent )
  : QToolButton( parent )
{
  setFocusPolicy( Qt::StrongFocus );

  // set default tool button icon properties
  setFixedSize( 22, 22 );
  setStyleSheet( QStringLiteral( "QToolButton{ background: none; border: 1px solid rgba(0, 0, 0, 0%);} QToolButton:focus { border: 1px solid palette(highlight); }" ) );
  setIconSize( QSize( 16, 16 ) );
  setPopupMode( QToolButton::InstantPopup );

  mMenu = new QMenu( this );
  connect( mMenu, &QMenu::aboutToShow, this, &QgsMultiEditToolButton::aboutToShowMenu );
  setMenu( mMenu );

  // sets initial appearance
  updateState();
}
Пример #8
0
QedTimeButton::QedTimeButton(QWidget *parent) : QToolButton(parent)
{
    my.state = Timeless;
    setIconSize(QSize(52, 52));
    setFocusPolicy(Qt::NoFocus);
    my.forwardLiveIcon = QIcon(":/images/play_live.png");
    my.stoppedLiveIcon = QIcon(":/images/stop_live.png");
    my.forwardRecordIcon = QIcon(":/images/play_record.png");
    my.stoppedRecordIcon = QIcon(":/images/stop_record.png");
    my.forwardArchiveIcon = QIcon(":/images/play_archive.png");
    my.stoppedArchiveIcon = QIcon(":/images/stop_archive.png");
    my.backwardArchiveIcon = QIcon(":/images/back_archive.png");
    my.stepForwardArchiveIcon = QIcon(":/images/stepfwd_archive.png");
    my.stepBackwardArchiveIcon = QIcon(":/images/stepback_archive.png");
    my.fastForwardArchiveIcon = QIcon(":/images/fastfwd_archive.png");
    my.fastBackwardArchiveIcon = QIcon(":/images/fastback_archive.png");
    console->post(QedApp::DebugUi, "Time button resources loaded");
}
Пример #9
0
        TabsTreeView( QWidget *parent = 0 )
            : Amarok::PrettyTreeView( parent )
        {
            setAttribute( Qt::WA_NoSystemBackground );
            viewport()->setAutoFillBackground( false );

            setHeaderHidden( true );
            setIconSize( QSize( 36, 36 ) );
            setDragDropMode( QAbstractItemView::DragOnly );
            setSelectionMode( QAbstractItemView::SingleSelection );
            setSelectionBehavior( QAbstractItemView::SelectItems );
            setAnimated( true );
            setRootIsDecorated( false );
            setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
            setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
            setFixedWidth( 48 );

        }
Пример #10
0
InlineView::InlineView(QWidget* parent) : QListWidget(parent)
{
	setDragEnabled(true);
	setViewMode(QListView::IconMode);
	setFlow(QListView::LeftToRight);
	setSortingEnabled(true);
	setWrapping(true);
	setAcceptDrops(true);
	setDropIndicatorShown(true);
	setDragDropMode(QAbstractItemView::DragDrop);
	setResizeMode(QListView::Adjust);
	setSelectionMode(QAbstractItemView::SingleSelection);
	setContextMenuPolicy(Qt::CustomContextMenu);
	delegate = new ScListWidgetDelegate(this, this);
	delegate->setIconOnly(true);
	setItemDelegate(delegate);
	setIconSize(QSize(50, 50));
}
// private
// LOOPT: This gets called twice on KolourPaint startup by:
//
//            1. setColorSimilarityInternal() called by the ctor
//            2. resizeEvent() when it's first shown()
//
//        We could get rid of the first and save a few milliseconds.
void kpColorSimilarityToolBarItem::updateIcon ()
{
    const int side = width () * 6 / 8;
#if DEBUG_KP_COLOR_SIMILARITY_TOOL_BAR_ITEM
    qCDebug(kpLogWidgets) << "kpColorSimilarityToolBarItem::updateIcon() width=" << width ()
              << " side=" << side << endl;
#endif

    QPixmap icon(side, side);
    icon.fill(Qt::transparent);

    kpColorSimilarityCubeRenderer::Paint (&icon,
        0/*x*/, 0/*y*/, side,
        colorSimilarity (), m_flashHighlight);

    setIconSize(QSize(side, side));
    setIcon(icon);
}
Пример #12
0
PageLayoutsWidget::PageLayoutsWidget(QWidget* parent) : QListWidget(parent)
{
	setDragEnabled(false);
	setViewMode(QListView::IconMode);
	setFlow(QListView::LeftToRight);
	setSortingEnabled(false);
	setWrapping(false);
	setWordWrap(true);
	setAcceptDrops(false);
	setDropIndicatorShown(false);
	setDragDropMode(QAbstractItemView::NoDragDrop);
	setResizeMode(QListView::Adjust);
	setSelectionMode(QAbstractItemView::SingleSelection);
	setFocusPolicy(Qt::NoFocus);
	setIconSize(QSize(32, 32));
	clear();
	setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
}
Пример #13
0
State2Button::State2Button(QWidget* parent, QString* path_enabled, QString* path_disabled, bool active) : QPushButton(parent) {
	setFlat(true);
	setFocusPolicy(Qt::NoFocus);
	resize(QSize(25, 25));
	setIconSize(QSize(23, 23));

	if (path_enabled != NULL)
		iconEnabled = new QIcon(RES->directory_qt + *path_enabled);
	if (path_disabled != NULL)
		iconDisabled = new QIcon(RES->directory_qt + *path_disabled);

	if (active)
		enable();
	else
		disable();

	QObject::connect(this, SIGNAL(clicked()), this, SLOT(buttonClicked()), Qt::DirectConnection);
}
Пример #14
0
ThumbnailController::ThumbnailController( QWidget * parent, ThumbnailList * list )
    : KToolBar( parent, "ThumbsControlBar" )
{
    // change toolbar appearance
    setMargin( 3 );
    setFlat( true );
    setIconSize( 16 );
    setMovingEnabled( false );

    // insert a togglebutton [show only bookmarked pages]
    //insertSeparator();
    insertButton( "bookmark", FILTERB_ID, SIGNAL( toggled( bool ) ),
                  list, SLOT( slotFilterBookmarks( bool ) ),
                  true, i18n( "Show bookmarked pages only" ) );
    setToggle( FILTERB_ID );
    setButton( FILTERB_ID, KpdfSettings::filterBookmarks() );
    //insertLineSeparator();
}
Пример #15
0
        AlbumsTreeView( QWidget *parent = 0 )
            : Amarok::PrettyTreeView( parent )
        {
            setAttribute( Qt::WA_NoSystemBackground );
            viewport()->setAutoFillBackground( false );

            setHeaderHidden( true );
            setIconSize( QSize(60,60) );
            setDragDropMode( QAbstractItemView::DragOnly );
            setSelectionMode( QAbstractItemView::ExtendedSelection );
            setSelectionBehavior( QAbstractItemView::SelectItems );
            //setAnimated( true ); // looks TERRIBLE
            
            setRootIsDecorated( false );

            setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
            setVerticalScrollMode( QAbstractItemView::ScrollPerPixel ); // Scrolling per item is really not smooth and looks terrible
        }
Пример #16
0
	void SBWidget::AddTrayAction (QAction *act)
	{
		connect (act,
				SIGNAL (destroyed (QObject*)),
				this,
				SLOT (handleTrayActDestroyed ()));

		auto tb = new QToolButton;
		const int w = maximumWidth () - TrayLay_->margin () * 4;
		tb->setMaximumSize (w, w);
		tb->setIconSize (IconSize_);
		tb->setAutoRaise (true);
		tb->setDefaultAction (act);
		tb->setPopupMode (QToolButton::DelayedPopup);
		TrayAct2Button_ [act] = tb;

		TrayLay_->addWidget (tb);
	}
Пример #17
0
void ToolButton::setToolbarButtonLook(bool enable)
{
    if (enable) {
        m_options |= ToolBarLookOption;

        QStyleOption opt;
        opt.initFrom(this);
        int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize, &opt, this);
        setIconSize(QSize(size, size));
    }
    else {
        m_options &= ~ToolBarLookOption;
    }

    setProperty("toolbar-look", QVariant(enable));
    style()->unpolish(this);
    style()->polish(this);
}
Пример #18
0
/*!
  \param pStackFramesWidget - pointer to StackFramesWidget
  */
StackFramesTreeWidget::StackFramesTreeWidget(StackFramesWidget *pStackFramesWidget)
  : QTreeWidget(pStackFramesWidget)
{
  mpStackFramesWidget = pStackFramesWidget;
  setItemDelegate(new ItemDelegate(this));
  setTextElideMode(Qt::ElideMiddle);
  setIconSize(Helper::iconSize);
  setColumnCount(3);
  QStringList headers;
  headers << tr("Function") << Helper::line << Helper::file;
  setHeaderLabels(headers);
  setIndentation(0);
  setExpandsOnDoubleClick(false);
  setContextMenuPolicy(Qt::CustomContextMenu);
  createActions();
  connect(mpStackFramesWidget->getMainWindow()->getGDBAdapter(), SIGNAL(stackListFrames(GDBMIValue*)), SLOT(createStackFrames(GDBMIValue*)));
  connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), mpStackFramesWidget, SLOT(stackItemDoubleClicked(QTreeWidgetItem*)));
  connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
}
Пример #19
0
StackTabBar::StackTabBar(StackTabWidget *parent) : QTabBar(parent) {
	setAcceptDrops(true);
    //this->setContentsMargins(0,0,0,0);
    //this->setTabsClosable(true);
    setMovable(true);
	m_parent = parent;
	setProperty("current","false");
	setExpanding(false);
	setElideMode(Qt::ElideRight);
	setIconSize(QSize(32, 32));

	setContextMenuPolicy(Qt::CustomContextMenu);
 
	connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(showContextMenu(const QPoint &)));

	m_dragMoveTimer.setSingleShot(true);
	m_dragMoveTimer.setInterval(250);
	connect(&m_dragMoveTimer, SIGNAL(timeout()), this, SLOT(setIndex()));
}
/**
 * @brief Creates an empty sprite tree view.
 * @param parent The parent object or nullptr.
 */
SpriteTreeView::SpriteTreeView(QWidget* parent) :
  QTreeView(parent),
  model(nullptr) {

  setIconSize(QSize(32, 32));
  setSelectionMode(QAbstractItemView::SingleSelection);
  setHeaderHidden(true);

  create_animation_action = new QAction(
        QIcon(":/images/icon_add.png"), tr("Create animation"), this);
  connect(create_animation_action, SIGNAL(triggered()),
          this, SIGNAL(create_animation_requested()));
  addAction(create_animation_action);

  create_direction_action = new QAction(
        QIcon(":/images/icon_add.png"), tr("Create direction"), this);
  connect(create_direction_action, SIGNAL(triggered()),
          this, SIGNAL(create_direction_requested()));
  addAction(create_direction_action);

  rename_animation_action = new QAction(
        QIcon(":/images/icon_rename.png"), tr("Rename animation"), this);
  rename_animation_action->setShortcut(tr("F2"));
  rename_animation_action->setShortcutContext(Qt::WidgetShortcut);
  connect(rename_animation_action, SIGNAL(triggered()),
          this, SIGNAL(rename_animation_requested()));
  addAction(rename_animation_action);

  duplicate_action = new QAction(
        QIcon(":/images/icon_copy.png"), tr("Duplicate..."), this);
  duplicate_action->setShortcutContext(Qt::WidgetShortcut);
  connect(duplicate_action, SIGNAL(triggered()),
          this, SIGNAL(duplicate_requested()));
  addAction(duplicate_action);

  delete_action = new QAction(
        QIcon(":/images/icon_delete.png"), tr("Delete..."), this);
  delete_action->setShortcut(QKeySequence::Delete);
  delete_action->setShortcutContext(Qt::WidgetShortcut);
  connect(delete_action, SIGNAL(triggered()),
          this, SIGNAL(delete_requested()));
  addAction(delete_action);
}
Пример #21
0
//-----------------------------------------------------------------------------
// Function: RibbonGroup::RibbonGroup()
//-----------------------------------------------------------------------------
RibbonGroup::RibbonGroup(QString const& title, Ribbon* parent)
    : QToolBar(parent),
      title_(title)
{

	const int BOTTOM_MARGIN = 15;
	const int TOP_MARGIN = 10;

	setIconSize(QSize (32, 32));
    setContentsMargins(0, TOP_MARGIN, 0, BOTTOM_MARGIN);
	layout()->setContentsMargins(0, TOP_MARGIN, 0, BOTTOM_MARGIN);

	QString style = 
		"QToolBar { margin-top: %1px; margin-left: %1px; margin-right: %1px; margin-bottom: %1px;}";
	setStyleSheet(style.arg(QString::number(HMARGIN)));

	QFontMetrics metrics(font());
	setMinimumWidth(metrics.width(title_) +  TITLE_MARGIN);
}
Пример #22
0
MusicToolSetsWidget::MusicToolSetsWidget(QWidget *parent)
    : QListWidget(parent), m_musicSpectrumWidget(NULL),
      m_wallpaper(NULL), m_process(NULL)
{
    setAttribute(Qt::WA_TranslucentBackground, true);
    setFrameShape(QFrame::NoFrame);//Set No Border
    setStyleSheet(MusicUIObject::MScrollBarStyle01);
    setIconSize(QSize(60, 60));
    setViewMode(QListView::IconMode);
    setMovement(QListView::Static);
    setSpacing(20);
    setTransparent(50);
    connect(this, SIGNAL(itemClicked(QListWidgetItem*)),
                  SLOT(itemHasClicked(QListWidgetItem*)));

    addListWidgetItem();
    M_CONNECTION->setValue("MusicToolSetsWidget", this);
    M_CONNECTION->connect("MusicToolSetsWidget", "MusicApplication");
}
Пример #23
0
// ---------------- ActionTreeView:
ActionTreeView::ActionTreeView(ActionModel *model, QWidget *parent) :
    QTreeView(parent),
    m_model(model)
{
    setDragEnabled(true);
    setAcceptDrops(true);
    setDropIndicatorShown(true);
    setDragDropMode(DragDrop);
    setModel(model);
    setRootIsDecorated(false);
    setTextElideMode(Qt::ElideMiddle);

    setModel(model);
    connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(slotActivated(QModelIndex)));
    connect(header(), SIGNAL(sectionDoubleClicked(int)), this, SLOT(resizeColumnToContents(int)));

    setIconSize(QSize(listModeIconSize, listModeIconSize));

}
Пример #24
0
GuiFindToolBar::GuiFindToolBar(GuiMainWindow *p)
    : QToolBar(p),
      mainWnd(p)
{
    searchedText = new QLineEdit();
    findTextFlag = false;
    currentRow = -1;
    currentCol = -1;
    pageStartPosition = 0;
    QToolButton *b;
    currentSearchedText = "";
    addWidget(searchedText);

    searchedText->installEventFilter(this);

    b = new QToolButton(this);
    b->setText("Up");
    connect(b, SIGNAL(clicked()), this, SLOT(on_findUp()));
    addWidget(b);

    b = new QToolButton(this);
    b->setText("Down");
    connect(b, SIGNAL(clicked()), this, SLOT(on_findDown()));
    addWidget(b);

    b = new QToolButton(this);
    b->setIcon(QIcon(":/images/cog_alt_16x16.png"));
    b->setMenu(p->menuGetMenuById(MENU_FIND_OPTIONS));
    b->setPopupMode(QToolButton::InstantPopup);
    addWidget(b);

    b = new QToolButton(this);
    b->setIcon(QIcon(":/images/x_14x14.png"));
    connect(b, SIGNAL(clicked()), this, SLOT(on_findClose()));
    addWidget(b);

    setIconSize(QSize(16, 16));
    setMovable(false);
    setAutoFillBackground(true);
    adjustSize();

    searchedText->setFocus();
}
Пример #25
0
void XCheckBox::setForgetful(bool p)
{
  if (_x_preferences && !p)
    _forgetful = _x_preferences->value("XCheckBox/forgetful").startsWith("t", Qt::CaseInsensitive);
  else
    _forgetful = p;
    
  if (! _forgetful)
  {
    Q_INIT_RESOURCE(widgets);
    if (! _checkedIcon)
      _checkedIcon = new QPixmap(":/widgets/images/xcheckbox.png");
      
    setIcon(*_checkedIcon);
    setIconSize(_checkedIcon->size());
  }
  else
    setIcon(QPixmap());    
}
Пример #26
0
QToolBar *MainWindow::toolBar()
{
    MyToolBar *toolBar = new MyToolBar(this);

    toolBar->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
    setToolButtonStyle(Qt::ToolButtonTextUnderIcon);

    d_startAction = new QAction(QIcon(start_xpm), "Clear", toolBar);
    d_startAction->setCheckable(true);
    d_clearAction = new QAction(QIcon(clear_xpm), "Clear", toolBar);
    QAction *whatsThisAction = QWhatsThis::createAction(toolBar);
    whatsThisAction->setText("Help");

    toolBar->addAction(d_startAction);
    toolBar->addAction(d_clearAction);
    toolBar->addAction(whatsThisAction);

    setIconSize(QSize(22, 22));

    QWidget *hBox = new QWidget(toolBar);

    d_randomCount = 
        new Counter(hBox, "Points", QString::null, 1, 100000, 100);
    d_randomCount->setValue(1000);

    d_timerCount = new Counter(hBox, "Delay", "ms", 0, 100000, 100);
    d_timerCount->setValue(0);

    QHBoxLayout *layout = new QHBoxLayout(hBox);
    layout->setMargin(0);
    layout->setSpacing(0);
    layout->addSpacing(10);
    layout->addWidget(new QWidget(hBox), 10); // spacer
    layout->addWidget(d_randomCount);
    layout->addSpacing(5);
    layout->addWidget(d_timerCount);

    showRunning(false);

    toolBar->addWidget(hBox);

    return toolBar;
}
Пример #27
0
void UWPButton::mouseReleaseEvent(QMouseEvent *event)
{
        setIcon(m_FocusIcon);
    setIconSize(iconSize()/res);
    QPushButton::mouseReleaseEvent(event);
    if(isCheckable())
    {
        QString r1 = ":/" + name + "_r";
        QString r2 = ":/" + name + "_r2";
        QString h1 = ":/" + name + "_h";
        QString h2 = ":/" + name + "_h2";
        QString p1 = ":/" + name + "_p";
        QString p2 = ":/" + name + "_p2";
        if(isChecked())
            SetButtonIcons(QIcon(r2), QIcon(h2), QIcon(p2));
        else
            SetButtonIcons(QIcon(r1), QIcon(h1), QIcon(p1));
    }
    send();
}
Пример #28
0
QgsPenStyleComboBox::QgsPenStyleComboBox( QWidget *parent )
  : QComboBox( parent )
{
  QList < QPair<Qt::PenStyle, QString> > styles;
  styles << qMakePair( Qt::SolidLine, tr( "Solid Line" ) )
         << qMakePair( Qt::NoPen, tr( "No Pen" ) )
         << qMakePair( Qt::DashLine, tr( "Dash Line" ) )
         << qMakePair( Qt::DotLine, tr( "Dot Line" ) )
         << qMakePair( Qt::DashDotLine, tr( "Dash Dot Line" ) )
         << qMakePair( Qt::DashDotDotLine, tr( "Dash Dot Dot Line" ) );

  setIconSize( QSize( 32, 12 ) );

  for ( int i = 0; i < styles.count(); i++ )
  {
    Qt::PenStyle style = styles.at( i ).first;
    QString name = styles.at( i ).second;
    addItem( iconForPen( style ), name, QVariant( ( int ) style ) );
  }
}
Пример #29
0
void AtomButton::refreshColor()
{
    int dimension1 = 18;
    int dimension2 = 18;

    QSize icon_box(dimension1, dimension2);
    QPixmap icon(icon_box);
    icon.fill(Preferences::_colorChanges.value(_label).value<QColor>());
    QPainter painter(&icon);
    QString text(_label);
    QFont font;
    font.setPointSize(12);
    painter.setFont(font);
    painter.drawText(QRectF(0, 0, dimension1, dimension2), Qt::AlignCenter, text);

    setIcon(icon);
    setText(text);
    setIconSize(icon_box);

}
Пример #30
0
OptionListWidget::OptionListWidget(QWidget* parent) : QListWidget(parent)
{
	setDragEnabled(false);
	setViewMode(QListView::IconMode);
	setFlow(QListView::TopToBottom);
	setSortingEnabled(false);
	setWrapping(false);
	setWordWrap(true);
	setAcceptDrops(false);
	setDropIndicatorShown(false);
	setDragDropMode(QAbstractItemView::NoDragDrop);
	setResizeMode(QListView::Adjust);
	setSelectionMode(QAbstractItemView::SingleSelection);
// #6930: This breaks focus on OSX, makes scrolling in this widget ugly for user data on the panes
//	setFocusPolicy(Qt::NoFocus);
	setIconSize(QSize(32, 32));
	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	clear();
	setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
}