コード例 #1
0
ファイル: issueswidget.cpp プロジェクト: uniblockchain/client
void IssuesWidget::addErrorWidget(QTreeWidgetItem *item, const QString &message, ErrorCategory category)
{
    QWidget *widget = 0;
    if (category == ErrorCategory::InsufficientRemoteStorage) {
        widget = new QWidget;
        auto layout = new QHBoxLayout;
        widget->setLayout(layout);

        auto label = new ElidedLabel(message, widget);
        label->setElideMode(Qt::ElideMiddle);
        layout->addWidget(label);

        auto button = new QPushButton("Retry all uploads", widget);
        button->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
        auto folderAlias = ProtocolItem::folderName(item);
        connect(button, &QPushButton::clicked,
            this, [this, folderAlias]() { retryInsufficentRemoteStorageErrors(folderAlias); });
        layout->addWidget(button);
    }

    if (widget) {
        item->setText(3, QString());
    }
    _ui->_treeWidget->setItemWidget(item, 3, widget);
}
コード例 #2
0
ファイル: tabbar.cpp プロジェクト: Manasmitha/quiterss
TabBar::TabBar(QWidget *parent)
  : QTabBar(parent)
  , closingTabState_(CloseTabIdle)
  , indexClickedTab_(-1)
  , tabFixed_(false)
{
  setObjectName("tabBar_");
  setFocusPolicy(Qt::NoFocus);
  setDocumentMode(true);
  setMouseTracking(true);
  setExpanding(false);
  setMovable(true);
  setElideMode(Qt::ElideNone);
  setIconSize(QSize(0, 0));
  setContextMenuPolicy(Qt::CustomContextMenu);

  setStyleSheet(QString("#tabBar_ QToolButton {border: 1px solid %1; border-radius: 2px; background: %2;}").
                arg(qApp->palette().color(QPalette::Dark).name()).
                arg(palette().background().color().name()));

  addTab("");

  connect(this, SIGNAL(customContextMenuRequested(QPoint)),
          this, SLOT(showContextMenuTabBar(const QPoint &)));

  installEventFilter(this);
}
コード例 #3
0
int QTabBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 8)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 8;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< Shape*>(_v) = shape(); break;
        case 1: *reinterpret_cast< int*>(_v) = currentIndex(); break;
        case 2: *reinterpret_cast< int*>(_v) = count(); break;
        case 3: *reinterpret_cast< bool*>(_v) = drawBase(); break;
        case 4: *reinterpret_cast< QSize*>(_v) = iconSize(); break;
        case 5: *reinterpret_cast< Qt::TextElideMode*>(_v) = elideMode(); break;
        case 6: *reinterpret_cast< bool*>(_v) = usesScrollButtons(); break;
        case 7: *reinterpret_cast< bool*>(_v) = tabsClosable(); break;
        case 8: *reinterpret_cast< SelectionBehavior*>(_v) = selectionBehaviorOnRemove(); break;
        case 9: *reinterpret_cast< bool*>(_v) = expanding(); break;
        case 10: *reinterpret_cast< bool*>(_v) = isMovable(); break;
        case 11: *reinterpret_cast< bool*>(_v) = documentMode(); break;
        }
        _id -= 12;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setShape(*reinterpret_cast< Shape*>(_v)); break;
        case 1: setCurrentIndex(*reinterpret_cast< int*>(_v)); break;
        case 3: setDrawBase(*reinterpret_cast< bool*>(_v)); break;
        case 4: setIconSize(*reinterpret_cast< QSize*>(_v)); break;
        case 5: setElideMode(*reinterpret_cast< Qt::TextElideMode*>(_v)); break;
        case 6: setUsesScrollButtons(*reinterpret_cast< bool*>(_v)); break;
        case 7: setTabsClosable(*reinterpret_cast< bool*>(_v)); break;
        case 8: setSelectionBehaviorOnRemove(*reinterpret_cast< SelectionBehavior*>(_v)); break;
        case 9: setExpanding(*reinterpret_cast< bool*>(_v)); break;
        case 10: setMovable(*reinterpret_cast< bool*>(_v)); break;
        case 11: setDocumentMode(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 12;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 12;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 12;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
コード例 #4
0
ファイル: tabbar.cpp プロジェクト: Arakmar/rekonq
TabBar::TabBar(QWidget *parent)
    : KTabBar(parent)
    , m_actualIndex(-1)
    , m_currentTabPreviewIndex(-1)
    , m_isFirstTimeOnTab(true)
    , m_tabHighlightEffect(new TabHighlightEffect(this))
    , m_animationMapper(new QSignalMapper(this))
{
    setElideMode(Qt::ElideRight);

    setDocumentMode(true);
    setTabsClosable(true);
    setMovable(true);

    setContextMenuPolicy(Qt::CustomContextMenu);

    // avoid ambiguos shortcuts. See BUG:275858
    KAcceleratorManager::setNoAccel(this);

    connect(this, SIGNAL(contextMenu(int, QPoint)), this, SLOT(contextMenu(int, QPoint)));
    connect(this, SIGNAL(emptyAreaContextMenu(QPoint)), this, SLOT(emptyAreaContextMenu(QPoint)));

    connect(m_animationMapper, SIGNAL(mapped(int)), this, SLOT(removeAnimation(int)));
    setGraphicsEffect(m_tabHighlightEffect);

    setAnimatedTabHighlighting(ReKonfig::animatedTabHighlighting());
    setAcceptDrops(true);
}
コード例 #5
0
ファイル: TabBarWidget.cpp プロジェクト: NYAMNYAM3/otter
TabBarWidget::TabBarWidget(QWidget *parent) : QTabBar(parent),
	m_previewWidget(NULL),
	m_tabSize(0),
	m_pinnedTabsAmount(0),
	m_clickedTab(-1),
	m_hoveredTab(-1),
	m_previewTimer(0),
	m_enablePreviews(true)
{
	qRegisterMetaType<WindowLoadingState>("WindowLoadingState");
	setDrawBase(false);
	setExpanding(false);
	setMovable(true);
	setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
	setElideMode(Qt::ElideRight);
	setMouseTracking(true);
	setDocumentMode(true);

	m_closeButtonPosition = static_cast<QTabBar::ButtonPosition>(QApplication::style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition));
	m_iconButtonPosition = ((m_closeButtonPosition == QTabBar::RightSide) ? QTabBar::LeftSide : QTabBar::RightSide);

	optionChanged(QLatin1String("TabBar/ShowCloseButton"), SettingsManager::getValue(QLatin1String("TabBar/ShowCloseButton")));
	optionChanged(QLatin1String("TabBar/EnablePreviews"), SettingsManager::getValue(QLatin1String("TabBar/EnablePreviews")));

	connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString,QVariant)));
	connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
	connect(this, SIGNAL(tabCloseRequested(int)), this, SIGNAL(requestedClose(int)));
}
コード例 #6
0
ファイル: tabbar.cpp プロジェクト: ff2000/qupzilla
TabBar::TabBar(QupZilla* mainClass, TabWidget* tabWidget)
    : QTabBar()
    , p_QupZilla(mainClass)
    , m_tabWidget(tabWidget)
    , m_tabPreview(new TabPreview(mainClass, tabWidget))
    , m_showTabPreviews(false)
    , m_clickedTab(0)
    , m_pinnedTabsCount(0)
    , m_normalTabWidth(0)
    , m_activeTabWidth(0)
{
    setObjectName("tabbar");
    setContextMenuPolicy(Qt::CustomContextMenu);
    setElideMode(Qt::ElideRight);
    setDocumentMode(true);
    setFocusPolicy(Qt::NoFocus);
    setTabsClosable(true);
    setMouseTracking(true);
    setMovable(true);

    setAcceptDrops(true);

    connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
    connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &)));
    connect(m_tabWidget, SIGNAL(pinnedTabClosed()), this, SLOT(pinnedTabClosed()));
    connect(m_tabWidget, SIGNAL(pinnedTabAdded()), this, SLOT(pinnedTabAdded()));

    m_tabPreviewTimer = new QTimer(this);
    m_tabPreviewTimer->setInterval(200);
    m_tabPreviewTimer->setSingleShot(true);
    connect(m_tabPreviewTimer, SIGNAL(timeout()), m_tabPreview, SLOT(hideAnimated()));
}
コード例 #7
0
ファイル: tabbar.cpp プロジェクト: agnelterry/arora
TabBar::TabBar(QWidget *parent)
    : QTabBar(parent)
    , m_viewTabBarAction(0)
    , m_showTabBarWhenOneTab(true)
{
    setContextMenuPolicy(Qt::CustomContextMenu);
    setAcceptDrops(true);
    setElideMode(Qt::ElideRight);
    setUsesScrollButtons(true);
    connect(this, SIGNAL(customContextMenuRequested(const QPoint &)),
            this, SLOT(contextMenuRequested(const QPoint &)));

    QString alt = QLatin1String("Ctrl+%1");
    for (int i = 0; i < 10; ++i) {
        int key = i == 9 ? 0 : i + 1;
        TabShortcut *tabShortCut = new TabShortcut(i, alt.arg(key), this);
        connect(tabShortCut, SIGNAL(activated()), this, SLOT(selectTabAction()));
    }

    m_viewTabBarAction = new QAction(this);
    updateViewToolBarAction();
    connect(m_viewTabBarAction, SIGNAL(triggered()),
            this, SLOT(viewTabBar()));
#if QT_VERSION >= 0x040500
    setMovable(true);
#endif
}
コード例 #8
0
PlaylistTabBar::PlaylistTabBar(QWidget* parent)
    : QTabBar(parent),
      manager_(nullptr),
      menu_(new QMenu(this)),
      menu_index_(-1),
      suppress_current_changed_(false),
      initialized_(false),
      rename_editor_(new RenameTabLineEdit(this)) {
  setAcceptDrops(true);
  setElideMode(Qt::ElideRight);
  setUsesScrollButtons(true);
  setTabsClosable(true);

  close_ = menu_->addAction(IconLoader::Load("list-remove", IconLoader::Base),
                            tr("Close playlist"), this, SLOT(Close()));
  rename_ = menu_->addAction(IconLoader::Load("edit-rename", IconLoader::Base),
                             tr("Rename playlist..."), this, SLOT(Rename()));
  save_ = menu_->addAction(IconLoader::Load("document-save", IconLoader::Base),
                           tr("Save playlist..."), this, SLOT(Save()));
  menu_->addSeparator();

  rename_editor_->setVisible(false);
  connect(rename_editor_, SIGNAL(editingFinished()), SLOT(RenameInline()));
  connect(rename_editor_, SIGNAL(EditingCanceled()), SLOT(HideEditor()));

  connect(this, SIGNAL(currentChanged(int)), SLOT(CurrentIndexChanged(int)));
  connect(this, SIGNAL(tabMoved(int, int)), SLOT(TabMoved()));
  // We can't just emit Close signal, we need to extract the playlist id first
  connect(this, SIGNAL(tabCloseRequested(int)), SLOT(CloseFromTabIndex(int)));
}
コード例 #9
0
QTabDrawer::QTabDrawer(QTabContainer* tabContainer) : QTabBar(tabContainer), tabContainer(tabContainer), pressedIndex(-1)
{
  //setMovable(true);
  setTabsClosable(true);
  setUsesScrollButtons(true);
  setElideMode(Qt::ElideRight);
  connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
}
コード例 #10
0
ファイル: pTabBar.cpp プロジェクト: pasnox/monkeystudio2
/*!
    \details Set if tabs text is elided or not
    \param elided True for elided text, else false
*/
void pTabBar::setTabsElided( bool elided )
{
    if ( aToggleTabsElided->isChecked() == elided && sender() != aToggleTabsElided )
        return;
    aToggleTabsElided->setChecked( elided );
    setElideMode( elided ? Qt::ElideMiddle : Qt::ElideNone );
    setTabText( 0, tabText( 0 ) ); // workaround for tabs update
    emit tabsElidedChanged( aToggleTabsElided->isChecked() );
}
コード例 #11
0
ファイル: TabBar.cpp プロジェクト: bloodwrath/x64dbg
//////////////////////////////////////////////////////////////
// Default Constructor
//////////////////////////////////////////////////////////////
MHTabBar::MHTabBar(QWidget* parent, bool allowDetach, bool allowDelete) : QTabBar(parent)
{
    mAllowDetach = allowDetach;
    mAllowDelete = allowDelete;
    setAcceptDrops(true);
    setElideMode(Qt::ElideRight);
    setSelectionBehaviorOnRemove(QTabBar::SelectLeftTab);
    setMovable(true);
}
コード例 #12
0
ファイル: tabbar.cpp プロジェクト: tsujan/FeatherPad
TabBar::TabBar (QWidget *parent)
    : QTabBar (parent)
{
    setMouseTracking (true);
    setElideMode (Qt::ElideMiddle); // works with minimumTabSizeHint()
    hideSingle_ = false;
    lock_ = false;
    dragStarted_ = false; // not needed
    noTabDND_ = false;
}
コード例 #13
0
int QTabBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: currentChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: selected((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: setCurrentIndex((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: setCurrentTab((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 4: d_func()->_q_scrollTabs(); break;
        }
        _id -= 5;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< Shape*>(_v) = shape(); break;
        case 1: *reinterpret_cast< int*>(_v) = currentIndex(); break;
        case 2: *reinterpret_cast< int*>(_v) = count(); break;
        case 3: *reinterpret_cast< bool*>(_v) = drawBase(); break;
        case 4: *reinterpret_cast< QSize*>(_v) = iconSize(); break;
        case 5: *reinterpret_cast< Qt::TextElideMode*>(_v) = elideMode(); break;
        case 6: *reinterpret_cast< bool*>(_v) = usesScrollButtons(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setShape(*reinterpret_cast< Shape*>(_v)); break;
        case 1: setCurrentIndex(*reinterpret_cast< int*>(_v)); break;
        case 3: setDrawBase(*reinterpret_cast< bool*>(_v)); break;
        case 4: setIconSize(*reinterpret_cast< QSize*>(_v)); break;
        case 5: setElideMode(*reinterpret_cast< Qt::TextElideMode*>(_v)); break;
        case 6: setUsesScrollButtons(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
コード例 #14
0
ファイル: footabbar.cpp プロジェクト: matthewpl/fooaudio
FooTabBar::FooTabBar (QWidget *parent) : QTabBar (parent), m_showTabBarWhenOneTab(true)
{
	setContextMenuPolicy (Qt::CustomContextMenu);
	setAcceptDrops (true);
	setElideMode (Qt::ElideRight);
	setUsesScrollButtons (true);

	connect(this, SIGNAL (customContextMenuRequested (const QPoint &)), this, SLOT (contextMenuRequested (const QPoint &)));

	setMovable(true);
}
コード例 #15
0
ファイル: TabWidget.cpp プロジェクト: ddksaku/manitou
TabWidget::TabWidget(QWidget *parent) :
    QTabWidget(parent)
{
    setDocumentMode(true);
    setElideMode(Qt::ElideRight);
    setMovable(true);
    setTabsClosable(true);
    setTabShape(QTabWidget::Rounded);
    setTabPosition(QTabWidget::North);
    setUsesScrollButtons(true);
}
コード例 #16
0
SideBar::SideBar(QWidget* parent)
: QTabWidget(parent)
, d(new SideBarPrivate)
{
    setFont(KGlobalSettings::smallestReadableFont());
    tabBar()->setDocumentMode(true);
    tabBar()->setUsesScrollButtons(false);
    tabBar()->setFocusPolicy(Qt::NoFocus);
    setTabPosition(QTabWidget::South);
    setElideMode(Qt::ElideRight);
}
コード例 #17
0
ファイル: tabwidget.cpp プロジェクト: c3c/quazaa
void CTabBar::changeEvent(QEvent* event)
{
    if (event->type() == QEvent::StyleChange) {
        Qt::TextElideMode mode = elideMode();
        QTabBar::changeEvent(event);
        if (mode != elideMode())
            setElideMode(mode);
        return;
    }
    QTabBar::changeEvent(event);
}
コード例 #18
0
ファイル: tabmanager.cpp プロジェクト: AG3/Lucky_OIer
TabManager::TabManager(QWidget *parent) :
    QTabWidget(parent)
{
    clear();
    setDocumentMode(true);
    setMovable(true);
    setTabsClosable(true);
    setElideMode(Qt::ElideRight);
    setTabPosition(QTabWidget::East);
    tab_count=1;
    new_file_count=1;
}
コード例 #19
0
ファイル: TabWindow.cpp プロジェクト: datallysis/pgadmin4
TabWindow::TabWindow(QWidget *parent) :
    QTabWidget(parent)
{
    setParent(parent);
    setTabsClosable(false);
    setElideMode(Qt::ElideRight);

    // Get the system colours we need
    QPalette palette = QApplication::palette("QPushButton");
    QColor activebg = palette.color(QPalette::Button);
    QColor activefg = palette.color(QPalette::ButtonText);
    QColor inactivebg = palette.color(QPalette::Dark);
    QColor inactivefg = palette.color(QPalette::ButtonText);
    QColor border = palette.color(QPalette::Mid);

    setStyleSheet(
        "QTabBar::tab { "
                "background-color: " + inactivebg.name() + "; "
                "color: " + inactivefg.name() + "; "
                "border: 1px solid " + border.name() + "; "
                "padding: 1px 0px; "
                "margin-left: 0px; "
                "margin-top: 1px; "
#ifndef __APPLE__
                "width: 15em; "
#ifdef _WIN32
                "height: 1.5em; "
#else
                "height: 1em; "
#endif
#endif
            "} "
        "QTabBar::tab:selected { "
                "background-color: " + activebg.name() + "; "
                "color: " + activefg.name() + "; "
                "border-bottom-style: none; "
            "} "
        "QTabWidget::pane { "
                "border: 0; "
            "} "
        "QTabWidget::tab-bar {"
                "alignment: left; "
            "}"
    );
#ifdef __APPLE__
    m_testTabBar = new TabBar();
    setTabBar(m_testTabBar);
#endif

    // Hide the default tab
    tabBar()->setVisible(false);
}
コード例 #20
0
ファイル: tabbar.cpp プロジェクト: char101/qupzilla
TabBar::TabBar(BrowserWindow* window, TabWidget* tabWidget)
    : ComboTabBar()
    , m_window(window)
    , m_tabWidget(tabWidget)
    , m_tabPreview(new TabPreview(window, window))
    , m_showTabPreviews(false)
    , m_hideTabBarWithOneTab(false)
    , m_showCloseOnInactive(0)
    , m_clickedTab(0)
    , m_normalTabWidth(0)
    , m_activeTabWidth(0)
{
    setObjectName("tabbar");
    setContextMenuPolicy(Qt::CustomContextMenu);
    setElideMode(Qt::ElideRight);
    setFocusPolicy(Qt::NoFocus);
    setTabsClosable(false);
    setMouseTracking(true);
    setDocumentMode(true);
    setAcceptDrops(true);
    setDrawBase(false);
    setMovable(true);

    connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
    connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));

    m_tabPreviewShowTimer = new QTimer(this);
    m_tabPreviewShowTimer->setInterval(300);
    m_tabPreviewShowTimer->setSingleShot(true);
    connect(m_tabPreviewShowTimer, SIGNAL(timeout()), this, SLOT(showTabPreview()));

    m_tabPreviewHideTimer = new QTimer(this);
    m_tabPreviewHideTimer->setInterval(300);
    m_tabPreviewHideTimer->setSingleShot(true);
    connect(m_tabPreviewHideTimer, SIGNAL(timeout()), m_tabPreview, SLOT(hideAnimated()));

    // ComboTabBar features
    setUsesScrollButtons(true);
    setCloseButtonsToolTip(BrowserWindow::tr("Close Tab"));
    connect(this, SIGNAL(scrollBarValueChanged(int)), this, SLOT(hideTabPreview()));
    connect(this, SIGNAL(overFlowChanged(bool)), this, SLOT(overflowChanged(bool)));

    if (mApp->isPrivate()) {
        QLabel* privateBrowsing = new QLabel(this);
        privateBrowsing->setObjectName(QSL("private-browsing-icon"));
        privateBrowsing->setPixmap(IconProvider::privateBrowsingIcon().pixmap(16, 16));
        privateBrowsing->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
        privateBrowsing->setFixedWidth(30);
        addCornerWidget(privateBrowsing, Qt::TopLeftCorner);
    }
}
コード例 #21
0
ファイル: stacktabwidget.cpp プロジェクト: Ipallis/Fritzing
StackTabWidget::StackTabWidget(QWidget *parent) : QTabWidget(parent) {
	setElideMode(Qt::ElideRight);

	setTabBar(new StackTabBar(this));

	connect(
		this, SIGNAL(currentChanged(int)),
		this, SLOT(informCurrentChanged(int))
	);
	connect(
		this, SIGNAL(tabCloseRequested(int)),
		this, SLOT(informTabCloseRequested(int))
	);
}
コード例 #22
0
ファイル: tabwidget.cpp プロジェクト: c3c/quazaa
CTabWidget::CTabWidget(QWidget* parent) : QTabWidget(parent)
{
    setTabBar(new CTabBar(this));
    setElideMode(Qt::ElideMiddle);
    d.previous = -1;
    d.updatingColors = false;

    d.colors[Active] = palette().color(QPalette::WindowText);
    d.colors[Inactive] = palette().color(QPalette::Disabled, QPalette::Highlight);
    d.colors[Alert] = palette().color(QPalette::Highlight);
    d.colors[Highlight] = palette().color(QPalette::Highlight);

    connect(this, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
    connect(tabBar(), SIGNAL(menuRequested(int, QPoint)), this, SIGNAL(tabMenuRequested(int, QPoint)));
}
コード例 #23
0
ファイル: tabbar.cpp プロジェクト: Fxrh/rekonq
TabBar::TabBar(QWidget *parent)
        : KTabBar(parent)
        , m_actualIndex(-1)
        , m_currentTabPreviewIndex(-1)
{
    setElideMode(Qt::ElideRight);

    setDocumentMode(true);
    setTabsClosable(true);
    setMovable(true);

    setContextMenuPolicy(Qt::CustomContextMenu);

    connect(this, SIGNAL(contextMenu(int, const QPoint &)), this, SLOT(contextMenu(int, const QPoint &)));
    connect(this, SIGNAL(emptyAreaContextMenu(const QPoint &)), this, SLOT(emptyAreaContextMenu(const QPoint &)));
}
コード例 #24
0
ファイル: separatetabbar.cpp プロジェクト: Akon32/leechcraft
	SeparateTabBar::SeparateTabBar (QWidget *parent)
	: QTabBar (parent)
	, Id_ (0)
	, IsLastTab_ (false)
	, InMove_ (false)
	{
		setObjectName ("org_LeechCraft_MainWindow_CentralTabBar");
		setExpanding (false);
		setIconSize (QSize (15, 15));
		setContextMenuPolicy (Qt::CustomContextMenu);
		setElideMode (Qt::ElideRight);

		addTab (QString ());

		IsLastTab_ = true;
	}
コード例 #25
0
/**
 * @brief Creates WorkAreaTabWidget.
 * @param workAreaWidget: WorkAreaWidget this tab belongs to.
 */
WorkAreaTabWidget::WorkAreaTabWidget(QWidget *parent) :
    QTabWidget(parent)
{
    WorkAreaTabBar *tab = new WorkAreaTabBar(this);
    // This line (setTabBar()) should go before setTabsClosable(true)
    setTabBar(tab);
    setTabsClosable(true);
    setElideMode(Qt::ElideRight);
    setMovable(true);
    setDocumentMode(true);

#ifdef Q_OS_MAC
    setDocumentMode(false);
    QFont font = tab->font();
    font.setPixelSize(12);
    tab->setFont(font);
    QString styles = QString(
                         "QTabWidget::pane { background-color: white; }"   // This style disables default styling under Mac
                         "QTabWidget::tab-bar {"
                         "alignment: left;"
                         "}"
                         "QTabBar::tab:selected { "
                         "background: white; /*#E1E1E1*/; "
                         "color: #282828;"
                         "} "
                         "QTabBar::tab {"
                         "color: #505050;"
                         "font-size: 11px;"
                         "background: %1;"
                         "border-right: 1px solid #aaaaaa;"
                         "padding: 4px 5px 7px 5px;"
                         "}"
                     ).arg(QWidget::palette().color(QWidget::backgroundRole()).darker(114).name());
    setStyleSheet(styles);
#endif


    VERIFY(connect(this, SIGNAL(tabCloseRequested(int)), SLOT(tabBar_tabCloseRequested(int))));
    VERIFY(connect(this, SIGNAL(currentChanged(int)), SLOT(ui_currentChanged(int))));

    VERIFY(connect(tab, SIGNAL(newTabRequested(int)), SLOT(ui_newTabRequested(int))));
    VERIFY(connect(tab, SIGNAL(reloadTabRequested(int)), SLOT(ui_reloadTabRequested(int))));
    VERIFY(connect(tab, SIGNAL(duplicateTabRequested(int)), SLOT(ui_duplicateTabRequested(int))));
    VERIFY(connect(tab, SIGNAL(closeOtherTabsRequested(int)), SLOT(ui_closeOtherTabsRequested(int))));
    VERIFY(connect(tab, SIGNAL(closeTabsToTheRightRequested(int)), SLOT(ui_closeTabsToTheRightRequested(int))));
}
コード例 #26
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();
}
コード例 #27
0
ファイル: TabBarWidget.cpp プロジェクト: aurhat/otter-browser
TabBarWidget::TabBarWidget(QWidget *parent) : QTabBar(parent),
	m_previewWidget(NULL),
	m_tabSize(0),
	m_maximumTabSize(40),
	m_minimumTabSize(250),
	m_pinnedTabsAmount(0),
	m_clickedTab(-1),
	m_hoveredTab(-1),
	m_previewTimer(0),
	m_showCloseButton(true),
	m_showUrlIcon(true),
	m_enablePreviews(true)
{
	qRegisterMetaType<WindowLoadingState>("WindowLoadingState");
	setDrawBase(false);
	setExpanding(false);
	setMovable(true);
	setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
	setElideMode(Qt::ElideRight);
	setMouseTracking(true);
	setDocumentMode(true);
	setMaximumSize(0, 0);
	setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
	setStyle(new TabBarStyle());

	m_closeButtonPosition = static_cast<QTabBar::ButtonPosition>(QApplication::style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition));
	m_iconButtonPosition = ((m_closeButtonPosition == QTabBar::RightSide) ? QTabBar::LeftSide : QTabBar::RightSide);

	optionChanged(QLatin1String("TabBar/ShowCloseButton"), SettingsManager::getValue(QLatin1String("TabBar/ShowCloseButton")));
	optionChanged(QLatin1String("TabBar/ShowUrlIcon"), SettingsManager::getValue(QLatin1String("TabBar/ShowUrlIcon")));
	optionChanged(QLatin1String("TabBar/EnablePreviews"), SettingsManager::getValue(QLatin1String("TabBar/EnablePreviews")));
	optionChanged(QLatin1String("TabBar/MaximumTabSize"), SettingsManager::getValue(QLatin1String("TabBar/MaximumTabSize")));
	optionChanged(QLatin1String("TabBar/MinimumTabSize"), SettingsManager::getValue(QLatin1String("TabBar/MinimumTabSize")));

	ToolBarWidget *toolBar = qobject_cast<ToolBarWidget*>(parent);

	if (toolBar)
	{
		setArea(toolBar->getArea());

		connect(toolBar, SIGNAL(areaChanged(Qt::ToolBarArea)), this, SLOT(setArea(Qt::ToolBarArea)));
	}

	connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString,QVariant)));
	connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
}
コード例 #28
0
ファイル: TabBarWidget.cpp プロジェクト: cgschwarz/otter
TabBarWidget::TabBarWidget(QWidget *parent) : QTabBar(parent),
	m_previewWidget(NULL),
	m_tabSize(0),
	m_clickedTab(-1),
	m_previewTimer(0)
{
	setDrawBase(false);
	setExpanding(false);
	setMovable(true);
	setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
	setTabsClosable(true);
	setElideMode(Qt::ElideRight);
	setMouseTracking(true);

	connect(this, SIGNAL(tabCloseRequested(int)), this, SIGNAL(requestedClose(int)));
	connect(this, SIGNAL(currentChanged(int)), this, SLOT(updateButtons()));
}
コード例 #29
0
    /**
     * @brief Creates WorkAreaTabWidget.
     * @param workAreaWidget: WorkAreaWidget this tab belongs to.
     */
    WorkAreaTabWidget::WorkAreaTabWidget(WorkAreaWidget *workAreaWidget) :
        QTabWidget(workAreaWidget),
        _bus(AppRegistry::instance().bus())
    {
        // This line (setTabBar()) should go before setTabsClosable(true)
        WorkAreaTabBar * tab = new WorkAreaTabBar(this);
        setTabBar(tab);
        setTabsClosable(true);
        setElideMode(Qt::ElideRight);

        VERIFY(connect(this, SIGNAL(tabCloseRequested(int)), SLOT(tabBar_tabCloseRequested(int))));
        VERIFY(connect(this, SIGNAL(currentChanged(int)), SLOT(ui_currentChanged(int))));

        VERIFY(connect(tab, SIGNAL(newTabRequested(int)), SLOT(ui_newTabRequested(int))));
        VERIFY(connect(tab, SIGNAL(reloadTabRequested(int)), SLOT(ui_reloadTabRequested(int))));
        VERIFY(connect(tab, SIGNAL(duplicateTabRequested(int)), SLOT(ui_duplicateTabRequested(int))));
        VERIFY(connect(tab, SIGNAL(closeOtherTabsRequested(int)), SLOT(ui_closeOtherTabsRequested(int))));
        VERIFY(connect(tab, SIGNAL(closeTabsToTheRightRequested(int)), SLOT(ui_closeTabsToTheRightRequested(int))));
    }
コード例 #30
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()));
}