Port convert KTabBar to QTabBar

1. Drag tabs doesn't work
2. Scroll wheel on tab doesn't work
3. Context menu doesn't work
wilder-portage
Kurt Hindenburg 11 years ago
parent 917eefc7d5
commit 1ace94f53a
  1. 16
      src/ViewContainer.cpp
  2. 5
      src/ViewContainerTabBar.cpp
  3. 5
      src/ViewContainerTabBar.h

@ -258,13 +258,14 @@ TabbedViewContainer::TabbedViewContainer(NavigationPosition position, ViewManage
_tabBar->setSupportedMimeType(ViewProperties::mimeType());
connect(_tabBar, &Konsole::ViewContainerTabBar::currentChanged, this, &Konsole::TabbedViewContainer::currentTabChanged);
connect(_tabBar, &Konsole::ViewContainerTabBar::tabDoubleClicked, this, &Konsole::TabbedViewContainer::tabDoubleClicked);
connect(_tabBar, &Konsole::ViewContainerTabBar::newTabRequest, this, static_cast<void(TabbedViewContainer::*)()>(&Konsole::TabbedViewContainer::newViewRequest));
connect(_tabBar, &Konsole::ViewContainerTabBar::wheelDelta, this, &Konsole::TabbedViewContainer::wheelScrolled);
connect(_tabBar, &Konsole::ViewContainerTabBar::initiateDrag, this, &Konsole::TabbedViewContainer::startTabDrag);
connect(_tabBar, &Konsole::ViewContainerTabBar::tabBarDoubleClicked, this, &Konsole::TabbedViewContainer::tabDoubleClicked);
connect(_tabBar, &Konsole::ViewContainerTabBar::querySourceIndex, this, &Konsole::TabbedViewContainer::querySourceIndex);
connect(_tabBar, &Konsole::ViewContainerTabBar::moveViewRequest, this, &Konsole::TabbedViewContainer::onMoveViewRequest);
connect(_tabBar, &Konsole::ViewContainerTabBar::contextMenu, this, &Konsole::TabbedViewContainer::openTabContextMenu);
// The below need converted to work with Qt5 QTabBar
//connect(_tabBar, &Konsole::ViewContainerTabBar::wheelDelta, this, &Konsole::TabbedViewContainer::wheelScrolled);
//connect(_tabBar, &Konsole::ViewContainerTabBar::initiateDrag, this, &Konsole::TabbedViewContainer::startTabDrag);
//connect(_tabBar, &Konsole::ViewContainerTabBar::contextMenu, this, &Konsole::TabbedViewContainer::openTabContextMenu);
// The context menu of tab bar
_contextPopupMenu = new QMenu(_tabBar);
@ -527,7 +528,10 @@ void TabbedViewContainer::onMoveViewRequest(int index, const QDropEvent* event ,
void TabbedViewContainer::tabDoubleClicked(int index)
{
renameTab(index);
if (index >= 0)
renameTab(index);
else
newViewRequest();
}
void TabbedViewContainer::renameTab(int index)

@ -29,6 +29,7 @@
#include <QtGui/QPainter>
#include <QtGui/QDragMoveEvent>
#include <QtGui/QIcon>
#include <QTabBar>
// KDE
#include <KLocalizedString>
@ -37,7 +38,7 @@ using Konsole::ViewContainerTabBar;
using Konsole::TabbedViewContainer;
ViewContainerTabBar::ViewContainerTabBar(QWidget* parent, TabbedViewContainer* container)
: KTabBar(parent)
: QTabBar(parent)
, _dropIndicator(0)
, _dropIndicatorIndex(-1)
, _drawIndicatorDisabled(false)
@ -126,7 +127,7 @@ void ViewContainerTabBar::setDropIndicator(int index, bool drawDisabled)
_dropIndicatorIndex = index;
const int ARROW_SIZE = 32;
const bool north = shape() == KTabBar::RoundedNorth || shape() == KTabBar::TriangularNorth;
const bool north = shape() == QTabBar::RoundedNorth || shape() == QTabBar::TriangularNorth;
if (!_dropIndicator || _drawIndicatorDisabled != drawDisabled) {
if (!_dropIndicator) {

@ -22,8 +22,7 @@
#ifndef VIEWCONTAINERTABBAR_H
#define VIEWCONTAINERTABBAR_H
// KDE
#include <KTabBar>
#include <QTabBar>
class QLabel;
@ -31,7 +30,7 @@ namespace Konsole
{
class TabbedViewContainer;
class ViewContainerTabBar : public KTabBar
class ViewContainerTabBar : public QTabBar
{
Q_OBJECT

Loading…
Cancel
Save