コード例 #1
0
void KMdiDocumentViewTabWidget::insertTab ( QWidget * child, QTab * tab, int index) {
	KTabWidget::insertTab(child,tab,index);
    showPage(child);
	maybeShow();
	tabBar()->repaint();
}
コード例 #2
0
ファイル: TabWidget.cpp プロジェクト: beans365/edb-debugger
//------------------------------------------------------------------------------
// Name: setData
// Desc:
//------------------------------------------------------------------------------
void TabWidget::setData(int index, const QVariant &data) {
	tabBar()->setTabData(index, data);
}
コード例 #3
0
ファイル: tabwidget.cpp プロジェクト: dimitarm1/Lorris
void TabWidget::pullTab(int index, TabWidget *origin, int to)
{
    int id = pullTab(index, origin);
    tabBar()->moveTab(id, to);
}
コード例 #4
0
ファイル: m11tabwidget.cpp プロジェクト: AlekSi/Jabbin
/** @todo more accuracy here: for HLine, VLine etc. */
void M11TabWidget::paintEvent(QPaintEvent* event)
{
    bool needBox = false;
    switch (m_frameShape) {
    case QFrame::HLine:
    case QFrame::VLine:
    case QFrame::Panel:
    case QFrame::WinPanel:
        ::QTabWidget::paintEvent(event);
        return;
    case QFrame::NoFrame:
        return;
    case QFrame::StyledPanel:
        break;
    case QFrame::Box:
        needBox = true;
        break;
    default:
        Q_ASSERT(false);
        break;
    }
    QPainter p(this);
    QRect r;
    switch (tabPosition()) {
    case North:
    case South:
        r = rect().adjusted(1, 1 + height() - tabBar()->height(), 0, 0);
        p.fillRect(r, Utils::instance().gradientTopToBottom(r));
        break;
    case West:
    case East:
        r = rect().adjusted(1 + width() - tabBar()->width(), 0, 0, 0);
        p.fillRect(r, Utils::instance().gradientTopToBottom(r));
        break;
    default:
        Q_ASSERT(false);
        break;
    }

    p.save();
    // p.setPen(Utils::instance().palette().alternateBase().color());
    // p.drawLine(rect().topRight(), rect().bottomRight());
    p.setPen(Utils::instance().palette().dark().color());
    int pos, w = width() - 1, h = height() - 1;
    switch (tabPosition()) {
    case North:
        pos = tabBar()->height() - 1;
        if (needBox) {
            p.drawLine(QPoint(0, pos), QPoint(0, h));
            p.drawLine(QPoint(0, h), QPoint(w, h));
            p.drawLine(QPoint(w, pos), QPoint(w, h));
            p.drawLine(QPoint(0, pos), QPoint(w, pos));
        } else {
            p.drawLine(QPoint(0, pos), QPoint(w, pos));
        }
        break;
    case South:
        pos = ++h - tabBar()->height();
        if (needBox) {
            // p.drawLine(QPoint(0, 0), QPoint(0, pos));
            p.drawLine(QPoint(0, pos), QPoint(w, pos));
            // p.drawLine(QPoint(w, 0), QPoint(w, pos));
            // p.drawLine(QPoint(0, 0), QPoint(w, 0));
        } else {
            p.drawLine(QPoint(0, pos), QPoint(w, pos));
        }
        break;
    case West:
        pos = tabBar()->width() - 1;
        if (needBox) {
            p.drawLine(QPoint(pos, 0), QPoint(pos, h));
            p.drawLine(QPoint(pos, h), QPoint(w, h));
            p.drawLine(QPoint(w, 0), QPoint(w, h));
            p.drawLine(QPoint(pos, 0), QPoint(w, 0));
        } else {
            p.drawLine(QPoint(pos, 0), QPoint(pos, h));
        }
        break;
    case East:
        pos = ++w - tabBar()->width();
        if (needBox) {
            p.drawLine(QPoint(0, 0), QPoint(0, h));
            p.drawLine(QPoint(0, h), QPoint(pos, h));
            p.drawLine(QPoint(pos, 0), QPoint(pos, h));
            p.drawLine(QPoint(0, 0), QPoint(pos, 0));
        } else {
            p.drawLine(QPoint(pos, 0), QPoint(pos, h));
        }
        break;
    default:
        Q_ASSERT(false);
        break;
    }
    p.restore();
}
コード例 #5
0
PTabWidget::PTabWidget(QWidget * parent) : QTabWidget(parent) {
        m_lastTabIndex = -1;

        connect(tabBar(), SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
}
コード例 #6
0
void TabWidget::contextMenuEvent(QContextMenuEvent* e) {
    Q_UNUSED(e);

    emit contextMenuAt(QCursor::pos(), tabBar()->tabAt(mapFromGlobal(QCursor::pos())));
}
コード例 #7
0
ファイル: DatabaseTabWidget.cpp プロジェクト: Typz/keepassx
void DatabaseTabWidget::toggleTabbar()
{
    tabBar()->setVisible(count() > 1);
}
コード例 #8
0
ファイル: tdeaboutdialog.cpp プロジェクト: Fat-Zer/tdelibs
    TQSize sizeHint() const {
	return TQTabWidget::sizeHint().expandedTo( tabBar()->sizeHint() + TQSize(4,4) );
    }
コード例 #9
0
	MyTabWidget(QWidget* parent) : QTabWidget(parent)
	{
		setTabBar(new MyTabBar(parent, "MyTabBar"));
		((MyTabBar*)tabBar())->hide();
	}
コード例 #10
0
void KPrView::initActions()
{
    setComponentData(KPrFactory::componentData());
    if (!koDocument()->isReadWrite() )
       setXMLFile( "stage_readonly.rc" );
    else
       setXMLFile( "stage.rc" );

    // do special stage stuff here
    m_actionExportHtml = new KAction(i18n("Export as HTML..."), this);
    actionCollection()->addAction("file_export_html", m_actionExportHtml);
    connect(m_actionExportHtml, SIGNAL(triggered()), this, SLOT(exportToHtml()));

    m_actionViewModeNormal = new KAction(m_normalMode->name(), this);
    m_actionViewModeNormal->setCheckable(true);
    m_actionViewModeNormal->setChecked(true);
    m_actionViewModeNormal->setShortcut(QKeySequence("CTRL+F5"));
    actionCollection()->addAction("view_normal", m_actionViewModeNormal);
    connect(m_actionViewModeNormal, SIGNAL(triggered()), this, SLOT(showNormal()));

    m_actionViewModeNotes = new KAction(m_notesMode->name(), this);
    m_actionViewModeNotes->setCheckable(true);
    m_actionViewModeNotes->setShortcut(QKeySequence("CTRL+F6"));
    actionCollection()->addAction("view_notes", m_actionViewModeNotes);
    connect(m_actionViewModeNotes, SIGNAL(triggered()), this, SLOT(showNotes()));

    m_actionViewModeSlidesSorter = new KAction(m_slidesSorterMode->name(), this);
    m_actionViewModeSlidesSorter->setCheckable(true);
    m_actionViewModeSlidesSorter->setShortcut(QKeySequence("CTRL+F7"));
    actionCollection()->addAction("view_slides_sorter", m_actionViewModeSlidesSorter);
    connect(m_actionViewModeSlidesSorter, SIGNAL(triggered()), this, SLOT(showSlidesSorter()));

    if ( QAction *action = actionCollection()->action("view_masterpages") )
        action->setShortcut(QKeySequence("CTRL+F8"));

    m_actionInsertPictures = new KAction(i18n("Insert Pictures as Slides..."), this);
    actionCollection()->addAction("insert_pictures", m_actionInsertPictures);
    connect(m_actionInsertPictures, SIGNAL(activated()), this, SLOT(insertPictures()));

    QActionGroup *viewModesGroup = new QActionGroup(this);
    viewModesGroup->addAction(m_actionViewModeNormal);
    viewModesGroup->addAction(m_actionViewModeNotes);
    viewModesGroup->addAction(m_actionViewModeSlidesSorter);

    m_actionCreateAnimation = new KAction( i18n( "Create Appear Animation" ), this );
    actionCollection()->addAction( "edit_createanimation", m_actionCreateAnimation );
    connect( m_actionCreateAnimation, SIGNAL(activated()), this, SLOT(createAnimation()) );

    m_actionEditCustomSlideShows = new KAction( i18n( "Edit Custom Slide Shows..." ), this );
    actionCollection()->addAction( "edit_customslideshows", m_actionEditCustomSlideShows );
    connect( m_actionEditCustomSlideShows, SIGNAL(activated()), this, SLOT(editCustomSlideShows()) );

    m_actionStartPresentation = new KActionMenu(koIcon("view-presentation"), i18n("Start Presentation"), this);
    actionCollection()->addAction( "slideshow_start", m_actionStartPresentation );
    connect( m_actionStartPresentation, SIGNAL(activated()), this, SLOT(startPresentation()) );
    KAction* action = new KAction( i18n( "From Current Slide" ), this );
    action->setShortcut(QKeySequence("Shift+F5"));
    m_actionStartPresentation->addAction( action );
    connect( action, SIGNAL(activated()), this, SLOT(startPresentation()) );
    action = new KAction( i18n( "From First Slide" ), this );
    action->setShortcut(QKeySequence("F5"));
    m_actionStartPresentation->addAction( action );
    connect( action, SIGNAL(activated()), this, SLOT(startPresentationFromBeginning()) );

    KToggleAction *showStatusbarAction = new KToggleAction(i18n("Show Status Bar"), this);
    showStatusbarAction->setCheckedState(KGuiItem(i18n("Hide Status Bar")));
    showStatusbarAction->setToolTip(i18n("Shows or hides the status bar"));
    actionCollection()->addAction("showStatusBar", showStatusbarAction);
    connect(showStatusbarAction, SIGNAL(toggled(bool)), this, SLOT(showStatusBar(bool)));

    //Update state of status bar action
    if (showStatusbarAction && statusBar()){
        showStatusbarAction->setChecked(! statusBar()->isHidden());
    }

    action = new KAction( i18n( "Configure Slide Show..." ), this );
    actionCollection()->addAction( "slideshow_configure", action );
    connect( action, SIGNAL(activated()), this, SLOT(configureSlideShow()) );

    action = new KAction( i18n( "Configure Presenter View..." ), this );
    actionCollection()->addAction( "slideshow_presenterview", action );
    connect( action, SIGNAL(activated()), this, SLOT(configurePresenterView()) );

    m_actionDrawOnPresentation = new KAction( i18n( "Draw on the presentation..." ), this );
    m_actionDrawOnPresentation->setShortcut(Qt::Key_P);
    m_actionDrawOnPresentation->setShortcutContext(Qt::ApplicationShortcut);
    actionCollection()->addAction( "draw_on_presentation", m_actionDrawOnPresentation );
    connect( m_actionDrawOnPresentation, SIGNAL(activated()), this, SLOT(drawOnPresentation()) );
    m_actionDrawOnPresentation->setEnabled(false);

    m_actionHighlightPresentation = new KAction( i18n( "Highlight the presentation..." ), this );
    m_actionHighlightPresentation->setShortcut(Qt::Key_H);
    m_actionHighlightPresentation->setShortcutContext(Qt::ApplicationShortcut);
    actionCollection()->addAction( "highlight_presentation", m_actionHighlightPresentation );
    connect( m_actionHighlightPresentation, SIGNAL(activated()), this, SLOT(highlightPresentation()) );
    m_actionHighlightPresentation->setEnabled(false);

    m_actionBlackPresentation = new KAction( i18n( "Blackscreen on the presentation..." ), this );
    m_actionBlackPresentation->setShortcut(Qt::Key_B);
    m_actionBlackPresentation->setShortcutContext(Qt::ApplicationShortcut);
    actionCollection()->addAction( "black_presentation", m_actionBlackPresentation );
    connect( m_actionBlackPresentation, SIGNAL(activated()), this, SLOT(blackPresentation()) );
    m_actionBlackPresentation->setEnabled(false);

    connect(tabBar(), SIGNAL(currentChanged(int)), this, SLOT(changeViewByIndex(int)));
}
コード例 #11
0
ファイル: tabwidget.cpp プロジェクト: woronin/kumir2
void TabWidget::disableTabs()
{
    tabBar()->setEnabled(false);
    tabBar()->setVisible(false);
}
コード例 #12
0
ファイル: stacktabwidget.cpp プロジェクト: honsey/fztaxedit
StackTabBar *StackTabWidget::stackTabBar() {
	return qobject_cast<StackTabBar*>(tabBar());
}
コード例 #13
0
/**
 * Close a tab at a given position
 * @param pos :: The tab at the given position
 */ 
void MultiTabScriptInterpreter::closeTabAtPosition(const QPoint & pos)
{
  int index = tabBar()->tabAt(pos);
  //Index is checked in closeTab
  closeTabAtIndex(index);
}
コード例 #14
0
ファイル: TabWidget.cpp プロジェクト: beans365/edb-debugger
//------------------------------------------------------------------------------
// Name: data
// Desc:
//------------------------------------------------------------------------------
QVariant TabWidget::data(int index) const {
	return tabBar()->tabData(index);
}
コード例 #15
0
ファイル: tabplaylist.cpp プロジェクト: ravloony/Miam-Player
QIcon TabPlaylist::defaultIcon(QIcon::Mode mode)
{
	QIcon icon(":/icons/playlistIcon");
	QIcon displayedIcon(icon.pixmap(QSize(tabBar()->fontMetrics().ascent(), tabBar()->fontMetrics().ascent()), mode));
	return displayedIcon;
}
コード例 #16
0
ファイル: highscoredialog.cpp プロジェクト: KDE/blinken
		QSize tabBarSizeHint() const
		{
			return tabBar() -> sizeHint();
		}
コード例 #17
0
QRect QTabContainer::findDropRect(const QPoint& globalPos, int tabWidth, QTabFramework::InsertPolicy& insertPolicy, QRect& tabRectResult, int& tabIndex)
{
  QPoint pos = mapFromGlobal(globalPos);
  QRect containerRect = rect();
  QRect result;
  tabIndex = -1;
  if(containerRect.contains(pos))
  {
    if(count() == 0)
    {
      insertPolicy = QTabFramework::InsertOnTop;
      result = containerRect;
    }
    else if(tabBar()->geometry().contains(pos))
    {
      insertPolicy = QTabFramework::Insert;
      result = containerRect;
      QTabBar* tabBar = this->tabBar();
      for(int i = 0, count = tabBar->count(); i < count; ++i)
      {
        QRect tabRect = tabBar->tabRect(i);
        if(tabRect.contains(pos))
        {
          tabRectResult = tabRect;
          tabRectResult.setRight(tabRect.left() + tabWidth);
          tabRectResult.translate(tabBar->mapToGlobal(QPoint(0, 0)));
          tabIndex = i;
          break;
        }
      }
    }
    else if(pos.x() < containerRect.x() + containerRect.width() / 3)
    {
      insertPolicy = QTabFramework::InsertLeft;
      result = QRect(containerRect.topLeft(), QPoint(containerRect.x() + containerRect.width() / 3, containerRect.bottom()));
    }
    else if(pos.x() >= containerRect.x() + containerRect.width() * 2 / 3)
    {
      insertPolicy = QTabFramework::InsertRight;
      result = QRect(QPoint(containerRect.x() + containerRect.width() * 2 / 3, containerRect.y()), containerRect.bottomRight());
    }
    else if(pos.y() < containerRect.y() + tabBar()->geometry().height())
    {
      insertPolicy = QTabFramework::Insert;
      result = containerRect;
      tabIndex = this->tabBar()->count();
    }
    else if(pos.y() < containerRect.y() + containerRect.height() / 3)
    {
      insertPolicy = QTabFramework::InsertTop;
      result = QRect(containerRect.topLeft(), QPoint(containerRect.right(), containerRect.y() + containerRect.height() / 3));
    }
    else if(pos.y() >= containerRect.y() + containerRect.height() * 2 / 3)
    {
      insertPolicy = QTabFramework::InsertBottom;
      result = QRect(QPoint(containerRect.x(), containerRect.y() + containerRect.height() * 2 / 3), containerRect.bottomRight());
    }
    else
    {
      insertPolicy = QTabFramework::InsertOnTop;
      result = containerRect;
    }
  }
  else
  {
    insertPolicy = QTabFramework::InsertFloating;
    return QRect();
  }
  result.translate(mapToGlobal(QPoint(0, 0)));
  return result;
}
コード例 #18
0
//--------------------------------------------------------------------------------------------
void MTelemetryTabWidgetStates::SlotIndexChanged(int newIndex)
{
  tabBar()->setTabTextColor(CurrentIndex, QColor(0,0,0));
  tabBar()->setTabTextColor(newIndex, QColor(0,0,255));
  CurrentIndex = newIndex;
}
コード例 #19
0
bool TabWidget::eventFilter(QObject *obj, QEvent *event)
{
    if (obj==tabBar())
    {
        // this code handles the tab movement
        if (event->type() == QEvent::Leave)
        {
            QPoint point = cross->mapToGlobal( QPoint(0, 0) );
            QRect rect(point.x(), point.y(), cross->width(), cross->height() );
            if ( !rect.contains( QCursor::pos() ) )
                cross->hide();
        }
        else if (event->type() == QEvent::HoverMove && m_closeButtonInTabs )
        {
            QHoverEvent *mouseEvent = static_cast<QHoverEvent *>(event);
            mousePos = mouseEvent->pos();
            for (int i=0; i<tabBar()->count(); i++)
            {
                if ( tabBar()->tabRect(i).contains( mouseEvent->pos() ) )
                {
                    m_clickedItem= i;
                    break;
                }
            }
            cross->setGeometry(tabBar()->tabRect(m_clickedItem).x()+tabBar()->tabRect(m_clickedItem).width()-cross->width()-5,
                               //tabBar()->height()-(tabBar()->tabRect(m_clickedItem).height()/2),
                               5,
                               cross->width(),
                               cross->height());
            cross->show();
        }
        else if (event->type() == QEvent::MouseButtonRelease )
        {
            qApp->restoreOverrideCursor();
        }
        else if (event->type() == QEvent::MouseButtonPress )
        {
            QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
            for (int i=0; i<tabBar()->count(); i++)
            {
                if ( tabBar()->tabRect(i).contains( mouseEvent->pos() ) )
                {
                    m_clickedItem = i;
                    break;
                }
            }
            if ( mouseEvent->button() == Qt::LeftButton )
                qApp->setOverrideCursor( Qt::OpenHandCursor );
            if ( mouseEvent->button() == Qt::RightButton )
            {
                QMenu *menu = new QMenu(this);
                connect(menu->addAction(QIcon(":/images/cross.png"), tr("Close Tab")), SIGNAL(triggered()), this, SLOT(slotCloseTab()) );
                connect(menu->addAction(QIcon(":/images/fileclose.png"), tr("Close Other Tabs")), SIGNAL(triggered()), this, SLOT(slotCloseOtherTab()) );
                connect(menu->addAction(QIcon(":/images/fileclose.png"), tr("Close All Tabs")), SIGNAL(triggered()), this, SLOT(slotCloseAllTab()) );
                menu->exec(mouseEvent->globalPos());
                delete menu;
            }
        }
        else if (event->type() == QEvent::MouseMove )
        {
            QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
            for (int i=0; i<tabBar()->count(); i++)
            {
                if ( tabBar()->tabRect(i).contains( mouseEvent->pos() ) )
                {
                    if ( swapTabs(i, m_clickedItem) )
                    {
                        setCurrentWidget(widget(i));
                        update();
                        int x;
                        if ( !tabBar()->tabRect(i).contains( mouseEvent->pos() ) )
                        {
                            if ( tabBar()->tabRect(m_clickedItem).x() < tabBar()->tabRect(i).x() )
                                x = tabBar()->tabRect(i).x();
                            else
                                x = tabBar()->tabRect(i).x()+(tabBar()->tabRect(i).width()-(qAbs(tabBar()->tabRect(i).width()-tabBar()->tabRect(m_clickedItem).width())));
                            QPoint point =  QPoint(
                                                x,
                                                mouseEvent->pos().y()
                                            );
                            point =  widget(i)->mapToGlobal( point );
                            m_clickedItem = i;
                            QCursor::setPos ( point.x(), QCursor::pos().y() );
                        }
                        m_clickedItem = i;
                        break;
                    }
                }
            }
        }
    }
    return QTabWidget::eventFilter( obj, event);
}
コード例 #20
0
void ByteViewTab::setTabsVisible() {
    if (count() > 1)
        tabBar()->show();
    else
        tabBar()->hide();
}
コード例 #21
0
KMdiDocumentViewTabWidget::KMdiDocumentViewTabWidget(QWidget* parent, const char* name):KTabWidget(parent,name), m_tabBarMenu(0) {
	m_visibility = KMdi::ShowWhenMoreThanOneTab;
	tabBar()->hide();
	setHoverCloseButton(true);
        connect(this, SIGNAL(closeRequest(QWidget*)), this, SLOT(closeTab(QWidget*)));
}
コード例 #22
0
ConcealedTabWidget::ConcealedTabWidget(QWidget *parent)
 : KTabWidget(parent)
{
    tabBar()->hide();
}
コード例 #23
0
void KMdiDocumentViewTabWidget::insertTab ( QWidget * child, const QIconSet & iconset, const QString & label, int index ) {
	KTabWidget::insertTab(child,iconset,label,index);
    showPage(child);
	maybeShow();
	tabBar()->repaint();
}
コード例 #24
0
ファイル: CTabWidget.cpp プロジェクト: Nikoli/qlandkartegt
CTabWidget::CTabWidget(QWidget * parent)
: QTabWidget(parent)
{
    tabBar()->hide();
}
コード例 #25
0
ファイル: m11tabwidget.cpp プロジェクト: AlekSi/Jabbin
void M11TabWidget::setTabTextColor(int index, QColor color) {
    static_cast<M11TabBar *>(tabBar())->setTabTextColor(index, color);
}