diff --git a/Plugins/org.blueberry.ui.qt/resources/darkstyle-activetab.qss b/Plugins/org.blueberry.ui.qt/resources/darkstyle-activetab.qss
index 8a85575500..bc47db2d10 100644
--- a/Plugins/org.blueberry.ui.qt/resources/darkstyle-activetab.qss
+++ b/Plugins/org.blueberry.ui.qt/resources/darkstyle-activetab.qss
@@ -1,8 +1,8 @@
-berry--QCTabBar::tab {
- background: #252526;
- color: #0097fb;
+berry--QCTabBar::tab:selected {
+ background-color: #1c97ea;
+ border: 1px solid #1c97ea;
}
-berry--QCTabBar::tab, QFrame#ViewFormContentFrame {
- border: 1px solid #3f3f46;
+#ViewFormContentFrame {
+ border: 1px solid #1c97ea;
}
diff --git a/Plugins/org.blueberry.ui.qt/resources/darkstyle-tab.qss b/Plugins/org.blueberry.ui.qt/resources/darkstyle-tab.qss
index b628597160..2ddea690f8 100644
--- a/Plugins/org.blueberry.ui.qt/resources/darkstyle-tab.qss
+++ b/Plugins/org.blueberry.ui.qt/resources/darkstyle-tab.qss
@@ -1,13 +1,8 @@
-berry--QCTabBar::tab {
- background: #2d2d30;
- color: #d0d0d0;
+berry--QCTabBar::tab:selected {
+ background-color: #434346;
+ border: 1px solid #434346;
}
-berry--QCTabBar::tab:hover {
- background: #3e3e40;
- color: #55aaff;
-}
-
-QFrame#ViewFormContentFrame {
- border: 1px solid #3f3f46;
+#ViewFormContentFrame {
+ border: 1px solid #434346;
}
diff --git a/Plugins/org.blueberry.ui.qt/resources/darkstyle.qss b/Plugins/org.blueberry.ui.qt/resources/darkstyle.qss
index bb4f590bb7..c81c59b8e4 100644
--- a/Plugins/org.blueberry.ui.qt/resources/darkstyle.qss
+++ b/Plugins/org.blueberry.ui.qt/resources/darkstyle.qss
@@ -1,417 +1,458 @@
/*===================================================================
BlueBerry Platform
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
/*
iconColor = #c7c7c7 <- This line is parsed by MITK
iconAccentColor = #d4821e <- This line is parsed by MITK
*/
QWidget {
background-color: #2d2d30;
border: none;
color: #f1f1f1;
}
QWidget:disabled {
background-color: #2d2d30;
border-color: #434346;
color: #656565;
}
QAbstractButton:hover, QComboBox:hover, QLineEdit:hover {
background-color: #3f3f46;
}
QAbstractButton:pressed, QAbstractButton:checked {
background-color: #434346;
}
QPushButton {
border: 1px solid #3f3f46;
padding: 4px 8px;
}
QPushButton:pressed {
border: 1px solid #434346;
}
QPushButton:checked, QToolButton:checked {
border: 1px solid #007acc;
}
QToolButton {
- padding: 2px 2px;
+ padding: 2px;
}
QToolBar QToolButton {
- padding: 4px 4px;
+ padding: 4px;
}
QAbstractItemView {
alternate-background-color: #1b1b1c;
background-color: #252526;
}
QHeaderView::section {
background-color: #2d2d30;
border: 1px solid transparent;
}
QHeaderView::section:horizontal {
border-right: 1px solid #3f3f46;
}
QHeaderView::section:vertical {
border-bottom: 1px solid #3f3f46;
}
QHeaderView::section:vertical:checked {
background-color: #1c97ea;
}
QHeaderView::section:vertical:pressed {
background-color: #1c97ea;
font-weight: bold;
}
QHeaderView::down-arrow {
image: url(:/org.blueberry.ui.qt/dark/down-arrow.svg);
height: 16px;
width: 16px;
}
QHeaderView::down-arrow:hover {
image: url(:/org.blueberry.ui.qt/dark/down-arrow-hover.svg);
}
QHeaderView::down-arrow:pressed {
image: url(:/org.blueberry.ui.qt/dark/down-arrow-pressed.svg);
}
QHeaderView::up-arrow {
image: url(:/org.blueberry.ui.qt/dark/up-arrow.svg);
height: 16px;
width: 16px;
}
QHeaderView::up-arrow:hover {
image: url(:/org.blueberry.ui.qt/dark/up-arrow-hover.svg);
}
QHeaderView::up-arrow:pressed {
image: url(:/org.blueberry.ui.qt/dark/up-arrow-pressed.svg);
}
QGroupBox {
border: 1px solid #434346;
margin-top: 8px;
padding-top: 8px;
}
QGroupBox, QGroupBox:disabled {
background-color: #252526;
}
QGroupBox::title {
padding: 0 4px;
subcontrol-origin: margin;
subcontrol-position: top center;
}
QComboBox, QLineEdit {
background-color: #333337;
border: 1px solid #434346;
}
QComboBox QAbstractItemView {
border: 1px solid #333337;
selection-background-color: #3f3f46;
}
QComboBox::drop-down {
image: url(:/org.blueberry.ui.qt/dark/down-arrow.svg);
subcontrol-origin: margin;
subcontrol-position: right;
width: 12px;
}
QComboBox::drop-down:hover {
background-color: #1f1f20;
border-left: 1px solid #007acc;
image: url(:/org.blueberry.ui.qt/dark/down-arrow-pressed.svg);
}
QCheckBox, QCheckBox:hover, QCheckBox:disabled, QCheckBox:checked, QRadioButton, QRadioButton:hover, QRadioButton:disabled, QRadioButton:checked {
background-color: none;
}
QCheckBox::indicator, QRadioButton::indicator {
height: 13px;
width: 13px;
}
QCheckBox::indicator:unchecked {
image: url(:/org.blueberry.ui.qt/dark/checkbox-unchecked.svg);
}
QCheckBox::indicator:unchecked:hover {
image: url(:/org.blueberry.ui.qt/dark/checkbox-unchecked-hover.svg);
}
QCheckBox::indicator:unchecked:disabled {
image: url(:/org.blueberry.ui.qt/dark/checkbox-unchecked-disabled.svg);
}
QCheckBox::indicator:checked {
image: url(:/org.blueberry.ui.qt/dark/checkbox-checked.svg);
}
QCheckBox::indicator:checked:hover {
image: url(:/org.blueberry.ui.qt/dark/checkbox-checked-hover.svg);
}
QCheckBox::indicator:checked:disabled {
image: url(:/org.blueberry.ui.qt/dark/checkbox-checked-disabled.svg);
}
QRadioButton::indicator:unchecked {
image: url(:/org.blueberry.ui.qt/dark/radiobutton-unchecked.svg);
}
QRadioButton::indicator:unchecked:hover {
image: url(:/org.blueberry.ui.qt/dark/radiobutton-unchecked-hover.svg);
}
QRadioButton::indicator:unchecked:disabled {
image: url(:/org.blueberry.ui.qt/dark/radiobutton-unchecked-disabled.svg);
}
QRadioButton::indicator:checked {
image: url(:/org.blueberry.ui.qt/dark/radiobutton-checked.svg);
}
QRadioButton::indicator:checked:hover {
image: url(:/org.blueberry.ui.qt/dark/radiobutton-checked-hover.svg);
}
QRadioButton::indicator:checked:disabled {
image: url(:/org.blueberry.ui.qt/dark/radiobutton-checked-disabled.svg);
}
QSlider::groove {
background-color: #686868;
}
QSlider::groove:hover {
background-color: #9e9e9e;
}
QSlider::groove:horizontal {
height: 3px;
}
QSlider::groove:vertical {
width: 3px;
}
QSlider::handle {
background-color: #686868;
}
QSlider::handle:hover {
background-color: #1c97ea;
}
QSlider::handle:pressed {
background-color: #007acc;
}
QSlider::handle:horizontal {
margin: -8px 0;
width: 8px;
}
QSlider::handle::vertical {
margin: 0 -8px;
height: 8px;
}
QLineEdit:hover {
border: 1px solid #2b7de1;
}
QLabel, QLabel:disabled {
background-color: none;
}
QMenu {
border: 1px solid #3e3e40;
}
QMenu QWidget {
background-color: #1b1b1c;
}
QMenu::item {
background-color: #1b1b1c;
}
QMenu::item:selected {
background-color: #333334;
}
QMenu::separator {
height: 1px;
background-color: #3e3e40;
}
QMenuBar::item:selected {
background-color: #3e3e40;
}
QScrollBar {
background-color: #3e3e42;
}
QScrollBar:horizontal {
height: 18px;
margin: 0 18px 0 18px;
}
QScrollBar:vertical {
width: 18px;
margin: 18px 0 18px 0;
}
QScrollBar::handle {
background-color: #686868;
}
QScrollBar::handle:hover {
background-color: #9e9e9e;
}
QScrollBar::handle:pressed {
background-color: #efebef;
}
QScrollBar::handle:horizontal {
min-width: 18px;
margin: 4px 0 5px 0;
}
QScrollBar::handle:vertical {
min-height: 18px;
margin: 0 5px 0 4px;
}
QScrollBar::add-page, QScrollBar::sub-page {
background-color: none;
}
QScrollBar::add-line, QScrollBar::sub-line {
background-color: #3e3e42;
subcontrol-origin: margin;
}
QScrollBar::add-line:horizontal {
subcontrol-position: right;
width: 18px;
}
QScrollBar::sub-line:horizontal {
subcontrol-position: left;
width: 18px;
}
QScrollBar::add-line:vertical {
subcontrol-position: bottom;
height: 18px;
}
QScrollBar::sub-line:vertical {
subcontrol-position: top;
height: 18px;
}
QScrollBar::up-arrow, QScrollBar::right-arrow, QScrollBar:down-arrow, QScrollBar:left-arrow {
width: 18px;
height: 18px;
}
QScrollBar::down-arrow {
image: url(:/org.blueberry.ui.qt/dark/down-arrow.svg);
}
QScrollBar::down-arrow:disabled {
image: url(:/org.blueberry.ui.qt/dark/down-arrow-disabled.svg);
}
QScrollBar::down-arrow:hover {
image: url(:/org.blueberry.ui.qt/dark/down-arrow-hover.svg);
}
QScrollBar::down-arrow:pressed {
image: url(:/org.blueberry.ui.qt/dark/down-arrow-pressed.svg);
}
QScrollBar::left-arrow {
image: url(:/org.blueberry.ui.qt/dark/left-arrow.svg);
}
QScrollBar::left-arrow:disabled {
image: url(:/org.blueberry.ui.qt/dark/left-arrow-disabled.svg);
}
QScrollBar::left-arrow:hover {
image: url(:/org.blueberry.ui.qt/dark/left-arrow-hover.svg);
}
QScrollBar::left-arrow:pressed {
image: url(:/org.blueberry.ui.qt/dark/left-arrow-pressed.svg);
}
QScrollBar::right-arrow {
image: url(:/org.blueberry.ui.qt/dark/right-arrow.svg);
}
QScrollBar::right-arrow:disabled {
image: url(:/org.blueberry.ui.qt/dark/right-arrow-disabled.svg);
}
QScrollBar::right-arrow:hover {
image: url(:/org.blueberry.ui.qt/dark/right-arrow-hover.svg);
}
QScrollBar::right-arrow:pressed {
image: url(:/org.blueberry.ui.qt/dark/right-arrow-pressed.svg);
}
QScrollBar::up-arrow {
image: url(:/org.blueberry.ui.qt/dark/up-arrow.svg);
}
QScrollBar::up-arrow:disabled {
image: url(:/org.blueberry.ui.qt/dark/up-arrow-disabled.svg);
}
QScrollBar::up-arrow:hover {
image: url(:/org.blueberry.ui.qt/dark/up-arrow-hover.svg);
}
QScrollBar::up-arrow:pressed {
image: url(:/org.blueberry.ui.qt/dark/up-arrow-pressed.svg);
}
+
+QTabWidget::pane {
+ border: 1px solid #434346;
+}
+
+QTabBar::tab {
+ background-color: #434346;
+ border: 1px solid #434346;
+ border-bottom: none;
+ padding: 4px;
+}
+
+QTabBar::tab:middle {
+ border-left: none;
+}
+
+QTabBar::tab:last {
+ border-left: none;
+}
+
+QTabBar::tab:next-selected {
+ border-right: none;
+}
+
+QTabBar::tab:selected {
+ border: 1px solid #434346;
+ border-bottom: none;
+}
+
+QTabBar::tab:!selected {
+ background-color: #2d2d30;
+ margin-top: 4px;
+}
+
+QTabBar::tab:!selected:hover {
+ background-color: #434346;
+}
+
+#TabCloseButton {
+ background-color: none;
+}
diff --git a/Plugins/org.blueberry.ui.qt/resources/org_blueberry_ui_qt.qrc b/Plugins/org.blueberry.ui.qt/resources/org_blueberry_ui_qt.qrc
index 11982043c8..4a347736e7 100755
--- a/Plugins/org.blueberry.ui.qt/resources/org_blueberry_ui_qt.qrc
+++ b/Plugins/org.blueberry.ui.qt/resources/org_blueberry_ui_qt.qrc
@@ -1,77 +1,76 @@
cursor_bottom.xpm
cursor_center.xpm
cursor_left.xpm
cursor_offscreen.xpm
cursor_right.xpm
cursor_top.xpm
dialog-error.svg
icon_missing.png
- tab_close_grey.svg
- tab_close_grey_active.svg
+ tab_close.svg
lightstyle.qss
lightstyle-activetab.qss
lightstyle-tab.qss
dark/Hmovetoolbar.png
dark/stylesheet-branch-end.png
dark/branch_closed-on.png
dark/stylesheet-vline.png
dark/branch_closed.png
dark/branch_open-on.png
dark/transparent.png
dark/right_arrows.svg
dark/sizegrip.png
dark/tab_close_grey.svg
dark/tab_close_grey_active.svg
dark/Vmovetoolbar.png
dark/stylesheet-branch-more.png
dark/Hsepartoolbar.png
dark/branch_open.png
dark/Vsepartoolbar.png
dark/undock.png
dark/down-arrow.svg
dark/down-arrow-disabled.svg
dark/down-arrow-hover.svg
dark/down-arrow-pressed.svg
dark/left-arrow.svg
dark/left-arrow-disabled.svg
dark/left-arrow-hover.svg
dark/left-arrow-pressed.svg
dark/right-arrow.svg
dark/right-arrow-disabled.svg
dark/right-arrow-hover.svg
dark/right-arrow-pressed.svg
dark/up-arrow.svg
dark/up-arrow-disabled.svg
dark/up-arrow-hover.svg
dark/up-arrow-pressed.svg
dark/checkbox-unchecked.svg
dark/checkbox-unchecked-hover.svg
dark/checkbox-unchecked-disabled.svg
dark/checkbox-checked.svg
dark/checkbox-checked-hover.svg
dark/checkbox-checked-disabled.svg
dark/radiobutton-unchecked.svg
dark/radiobutton-unchecked-hover.svg
dark/radiobutton-unchecked-disabled.svg
dark/radiobutton-checked.svg
dark/radiobutton-checked-hover.svg
dark/radiobutton-checked-disabled.svg
darkstyle.qss
darkstyle-tab.qss
darkstyle-activetab.qss
fonts/FiraSans/FiraSans.ttf
fonts/LightFiraSans/LightFiraSans.ttf
fonts/Roboto/Roboto.ttf
fonts/OpenSans/OpenSans-Regular.ttf
fonts/xkcd/xkcd.ttf
diff --git a/Plugins/org.blueberry.ui.qt/resources/tab_close.svg b/Plugins/org.blueberry.ui.qt/resources/tab_close.svg
new file mode 100644
index 0000000000..7a3bdfb95a
--- /dev/null
+++ b/Plugins/org.blueberry.ui.qt/resources/tab_close.svg
@@ -0,0 +1,56 @@
+
+
diff --git a/Plugins/org.blueberry.ui.qt/resources/tab_close_grey.svg b/Plugins/org.blueberry.ui.qt/resources/tab_close_grey.svg
deleted file mode 100644
index 509788d4f1..0000000000
--- a/Plugins/org.blueberry.ui.qt/resources/tab_close_grey.svg
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
diff --git a/Plugins/org.blueberry.ui.qt/resources/tab_close_grey_active.svg b/Plugins/org.blueberry.ui.qt/resources/tab_close_grey_active.svg
deleted file mode 100644
index 2ebf9d201d..0000000000
--- a/Plugins/org.blueberry.ui.qt/resources/tab_close_grey_active.svg
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
diff --git a/Plugins/org.blueberry.ui.qt/src/internal/defaultpresentation/berryNativeTabFolder.cpp b/Plugins/org.blueberry.ui.qt/src/internal/defaultpresentation/berryNativeTabFolder.cpp
index 692745d73a..30904f80f7 100755
--- a/Plugins/org.blueberry.ui.qt/src/internal/defaultpresentation/berryNativeTabFolder.cpp
+++ b/Plugins/org.blueberry.ui.qt/src/internal/defaultpresentation/berryNativeTabFolder.cpp
@@ -1,363 +1,286 @@
/*===================================================================
BlueBerry Platform
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "berryNativeTabFolder.h"
#include "berryNativeTabItem.h"
#include "berryQCTabBar.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace berry
{
AbstractTabItem* NativeTabFolder::GetTab(int index)
{
return tabControl->getTab(index);
}
void NativeTabFolder::TabSelectionChanged(int index)
{
this->FireEvent(TabFolderEvent::EVENT_TAB_SELECTED, tabControl->getTab(index));
}
void NativeTabFolder::DragStarted(const QPoint& location)
{
this->HandleDragStarted(location);
}
void NativeTabFolder::ViewFormDestroyed(QObject*)
{
viewForm = nullptr;
content = nullptr;
}
NativeTabFolder::NativeTabFolder(QWidget* parent)
: QObject(parent)
{
content = nullptr;
viewForm = new QtControlWidget(parent, nullptr);
viewForm->setObjectName("ViewForm");
viewForm->installEventFilter(this);
auto layout = new QVBoxLayout(viewForm);
layout->setContentsMargins(0,0,0,0);
layout->setSpacing(0);
viewForm->setLayout(layout);
connect(viewForm, SIGNAL(destroyed(QObject*)), this, SLOT(ViewFormDestroyed(QObject*)));
auto topControls = new QWidget(viewForm);
- topControls->setMinimumSize(0, 24);
- topControls->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+ //topControls->setMinimumSize(0, 24);
+ //topControls->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
layout->addWidget(topControls);
auto topLayout = new QHBoxLayout(topControls);
topLayout->setContentsMargins(0, 0, 0, 0);
topLayout->setSpacing(0);
tabControl = new QCTabBar(topControls);
tabControl->installEventFilter(this);
- tabControl->setMinimumSize(0, 25);
- tabControl->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+ //tabControl->setMinimumSize(0, 25);
+ //tabControl->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
topLayout->addWidget(tabControl);
auto topRightControls = new QFrame(topControls);
topRightControls->setObjectName("TabTopRightControls");
- topRightControls->setMinimumSize(6, 25);
- topRightControls->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ //topRightControls->setMinimumSize(6, 25);
+ //topRightControls->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
topLayout->addWidget(topRightControls);
contentFrame = new QFrame(viewForm);
contentFrame->setObjectName("ViewFormContentFrame");
contentFrame->installEventFilter(this);
contentFrame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
auto contentFrameLayout = new QVBoxLayout(contentFrame);
contentFrameLayout->setContentsMargins(0,0,0,0);
contentFrameLayout->setSpacing(0);
- //contentFrame->setLayout(layout);
layout->addWidget(contentFrame);
this->connect(tabControl, SIGNAL(currentChanged(int)), this,
SLOT(TabSelectionChanged(int)));
this->connect(tabControl, SIGNAL(dragStarted(const QPoint&)), this,
SLOT(DragStarted(const QPoint&)));
-
- //std::cout << "Created: viewForm <-- " << qPrintable(parent->objectName());
- //for (parent = parent->parentWidget(); parent != 0; parent = parent->parentWidget())
- // std::cout << " <-- " << qPrintable(parent->objectName());
- //std::cout << std::endl;
-
- //parent = viewForm;
- //std::cout << "Created control: QCTabBar <-- " << qPrintable(parent->objectName());
- //for (parent = parent->parentWidget(); parent != 0; parent = parent->parentWidget())
- // std::cout << " <-- " << qPrintable(parent->objectName());
- //std::cout << std::endl;
-
- //attachListeners(control, false);
-
- // viewForm = new ViewForm(control, SWT.FLAT);
- // attachListeners(viewForm, false);
- // systemToolbar = new StandardSystemToolbar(viewForm, true, false, true, true, true);
- // systemToolbar.addListener(systemToolbarListener);
- // viewForm.setTopRight(systemToolbar.getControl());
- //
- // topCenter = new ProxyControl(viewForm);
- // topCenterCache = new SizeCache();
- //
- // title = new CLabel(viewForm, SWT.LEFT);
- // attachListeners(title, false);
- // viewForm.setTopLeft(title);
-
ctkServiceReference serviceRef = WorkbenchPlugin::GetDefault()->GetPluginContext()->getServiceReference();
if (serviceRef)
{
skinManager = WorkbenchPlugin::GetDefault()->GetPluginContext()->getService(serviceRef);
}
}
NativeTabFolder::~NativeTabFolder()
{
if (!PlatformUI::GetWorkbench()->IsClosing())
{
BERRY_DEBUG << "Deleting viewForm";
if (content != nullptr)
{
content->setParent(nullptr);
}
viewForm->deleteLater();
}
}
bool NativeTabFolder::eventFilter(QObject* watched, QEvent* event)
{
if (event->type() == QEvent::MouseButtonPress)
{
QMouseEvent* mouseEvent = static_cast(event);
this->HandleMousePress(mouseEvent->pos());
}
return QObject::eventFilter(watched, event);
}
-void NativeTabFolder::UpdateColors()
-{
- QString tabStyle = this->GetActive() == 1 ? skinManager->GetActiveTabStylesheet() : skinManager->GetTabStylesheet();
-
- //tabControl->setStyleSheet(tabSkin);
- //contentFrame->setStyleSheet(tabSkin);
- viewForm->setStyleSheet(tabStyle);
-}
-
void NativeTabFolder::SetActive(int activeState)
{
AbstractTabFolder::SetActive(activeState);
this->UpdateColors();
}
+void NativeTabFolder::UpdateColors()
+{
+ viewForm->setStyleSheet(1 == this->GetActive()
+ ? skinManager->GetActiveTabStylesheet()
+ : skinManager->GetTabStylesheet());
+}
+
void NativeTabFolder::CloseButtonClicked(AbstractTabItem* item)
{
this->FireEvent(TabFolderEvent::EVENT_CLOSE, item);
}
QSize NativeTabFolder::ComputeSize(int /*widthHint*/, int /*heightHint*/)
{
return QSize(50,50);
}
AbstractTabItem* NativeTabFolder::Add(int index, int flags)
{
auto item = new NativeTabItem(this, index, flags);
return item;
}
void NativeTabFolder::Move(int from, int to)
{
int tabCount = tabControl->count();
if (to > tabCount) to = tabCount;
tabControl->moveAbstractTab(from, to);
}
void NativeTabFolder::Layout(bool flushCache)
{
AbstractTabFolder::Layout(flushCache);
-
-// QRect rect1 = tabControl->geometry();
-// QRect rect2 = viewForm->geometry();
-// std::cout << "QCTabBar geometry is: x=" << rect1.x() << ", y=" << rect1.y() << ", width=" << rect1.width() << ", height=" << rect1.height() << std::endl;
-// std::cout << "ViewForm geometry is: " << rect2.x() << ", y=" << rect2.y() << ", width=" << rect2.width() << ", height=" << rect2.height() << std::endl;
-
-// Rectangle oldBounds = viewForm.getBounds();
-// Rectangle newBounds = control.getClientArea();
-//
-// viewForm.setBounds(newBounds);
-//
-// if (Util.equals(oldBounds, newBounds))
-// {
-// viewForm.layout(flushCache);
-// }
}
QPoint NativeTabFolder::GetPaneMenuLocation()
{
return AbstractTabFolder::GetPaneMenuLocation();
- //return systemToolbar.getPaneMenuLocation();
}
void NativeTabFolder::SetState(int state)
{
AbstractTabFolder::SetState(state);
-
- //systemToolbar.setState(state);
}
QRect NativeTabFolder::GetClientArea()
{
if (content == nullptr)
{
return QRect();
}
return content->geometry();
}
QList NativeTabFolder::GetItems()
{
return tabControl->getTabs();
}
void NativeTabFolder::SetSelection(AbstractTabItem* toSelect)
{
if (toSelect == nullptr)
{
return;
}
tabControl->setCurrentTab(toSelect);
}
-void NativeTabFolder::SetSelectedInfo(const PartInfo& /*info*/)
+void NativeTabFolder::SetSelectedInfo(const PartInfo&)
{
-// if (!Util.equals(title.getText(), info.title))
-// {
-// title.setText(info.title);
-// }
-// if (title.getImage() != info.image)
-// {
-// title.setImage(info.image);
-// }
}
QRect NativeTabFolder::GetTabArea()
{
-
return tabControl->geometry();
-
-// Rectangle bounds = control.getBounds();
-//
-// Rectangle clientArea = control.getClientArea();
-//
-// bounds.x = 0;
-// bounds.y = 0;
-// Geometry.expand(bounds, 0, 0, -(clientArea.height + clientArea.y), 0);
-//
-// return Geometry.toDisplay(control.getParent(), bounds);
}
QWidget* NativeTabFolder::GetControl()
{
return viewForm;
}
-bool NativeTabFolder::IsOnBorder(const QPoint& /*globalPos*/)
+bool NativeTabFolder::IsOnBorder(const QPoint& )
{
-// Point localPos = getControl().toControl(globalPos);
-//
-// Rectangle clientArea = getClientArea();
-// return localPos.y > clientArea.y && localPos.y < clientArea.y
-// + clientArea.height;
return false;
}
AbstractTabItem* NativeTabFolder::GetSelection()
{
return tabControl->getCurrentTab();
}
QWidget* NativeTabFolder::GetContentParent()
{
return contentFrame;
}
void NativeTabFolder::SetContent(QWidget* newContent)
{
- //viewForm.setContent(newContent);
if (content != nullptr)
{
contentFrame->layout()->removeWidget(content);
disconnect(content);
}
content = newContent;
content->installEventFilter(this);
- //((QBoxLayout*)contentFrame->layout())->addWidget(content, 1);
contentFrame->layout()->addWidget(content);
}
QCTabBar* NativeTabFolder::GetTabFolder()
{
return tabControl;
}
-void NativeTabFolder::SetSelectedTitle(const QString& /*newTitle*/)
+void NativeTabFolder::SetSelectedTitle(const QString&)
{
- //title.setText(newTitle);
}
-void NativeTabFolder::SetSelectedImage(const QPixmap* /*image*/)
+void NativeTabFolder::SetSelectedImage(const QPixmap*)
{
- //title.setImage(image);
}
AbstractTabItem* NativeTabFolder::GetItem(const QPoint& toFind)
{
QPoint localPoint = tabControl->mapFromGlobal(toFind);
int index = tabControl->tabAt(localPoint);
if (index < 0)
return nullptr;
return tabControl->getTab(index);
}
-void NativeTabFolder::EnablePaneMenu(bool /*enabled*/)
+void NativeTabFolder::EnablePaneMenu(bool)
{
- //systemToolbar.enablePaneMenu(enabled);
}
}
diff --git a/Plugins/org.blueberry.ui.qt/src/internal/defaultpresentation/berryNativeTabFolder.h b/Plugins/org.blueberry.ui.qt/src/internal/defaultpresentation/berryNativeTabFolder.h
index 4717487387..5da3746924 100755
--- a/Plugins/org.blueberry.ui.qt/src/internal/defaultpresentation/berryNativeTabFolder.h
+++ b/Plugins/org.blueberry.ui.qt/src/internal/defaultpresentation/berryNativeTabFolder.h
@@ -1,230 +1,184 @@
/*===================================================================
BlueBerry Platform
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef BERRYNATIVETABFOLDER_H_
#define BERRYNATIVETABFOLDER_H_
#include
#include
class QFrame;
class QWidget;
namespace berry
{
struct IQtStyleManager;
class QCTabBar;
class NativeTabFolder: public QObject, public AbstractTabFolder
{
Q_OBJECT
private:
QCTabBar* tabControl;
QFrame* contentFrame;
QWidget* viewForm;
QWidget* content;
- // ViewForm viewForm;
- // StandardSystemToolbar systemToolbar;
- // CLabel title;
- // ProxyControl topCenter;
- // SizeCache topCenterCache;
-
- // IPropertyListener systemToolbarListener = new IPropertyListener() {
- //
- // public void propertyChanged(Object source, int propId) {
- // Point location;
- //
- // if (propId == TabFolderEvent.EVENT_PANE_MENU) {
- // location = getPaneMenuLocation();
- // } else {
- // location = new Point(0,0);
- // }
- //
- // fireEvent(propId, getSelection(), location);
- // }
- //
- // };
IQtStyleManager* skinManager;
/**
* @param item
* @return
*/
AbstractTabItem* GetTab(int index);
private slots:
void TabSelectionChanged(int index);
void DragStarted(const QPoint& location);
void ViewFormDestroyed(QObject*);
public:
NativeTabFolder(QWidget* parent);
~NativeTabFolder() override;
void UpdateColors();
void SetActive(int activeState) override;
bool eventFilter(QObject* watched, QEvent* event) override;
void CloseButtonClicked(AbstractTabItem* item);
/* (non-Javadoc)
* @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#computeSize(int, int)
*/
QSize ComputeSize(int widthHint, int heightHint) override;
/* (non-Javadoc)
* @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#add(int)
*/
AbstractTabItem* Add(int index, int flags) override;
/* (non-Javadoc)
* @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#move(int, int)
*/
void Move(int from, int to) override;
/* (non-Javadoc)
* @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#layout(boolean)
*/
void Layout(bool flushCache) override;
/* (non-Javadoc)
* @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#getPaneMenuLocation()
*/
QPoint GetPaneMenuLocation() override;
/* (non-Javadoc)
* @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#setState(int)
*/
void SetState(int state) override;
/* (non-Javadoc)
* @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#getClientArea()
*/
QRect GetClientArea();
/* (non-Javadoc)
* @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#getItems()
*/
QList GetItems() override;
/* (non-Javadoc)
* @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#setSelection(org.blueberry.ui.internal.presentations.util.Widget)
*/
void SetSelection(AbstractTabItem* toSelect) override;
/* (non-Javadoc)
* @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#setSelectedInfo(org.blueberry.ui.internal.presentations.util.PartInfo)
*/
void SetSelectedInfo(const PartInfo& info) override;
- // /* (non-Javadoc)
- // * @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#getToolbarParent()
- // */
- // Composite getToolbarParent() {
- // return viewForm;
- // }
-
/* (non-Javadoc)
* @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#getTabArea()
*/
QRect GetTabArea() override;
- // /* (non-Javadoc)
- // * @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#setToolbar(org.blueberry.swt.widgets.Control)
- // */
- // void setToolbar(Control toolbarControl) {
- //
- // if (toolbarControl != null) {
- // topCenterCache.setControl(toolbarControl);
- // topCenter.setTarget(topCenterCache);
- // viewForm.setTopCenter(topCenter.getControl());
- // } else {
- // topCenterCache.setControl(null);
- // topCenter.setTarget(null);
- // viewForm.setTopCenter(null);
- // }
- //
- // super.setToolbar(toolbarControl);
- // }
-
QWidget* GetControl() override;
/* (non-Javadoc)
* @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#isOnBorder(org.blueberry.swt.graphics.Point)
*/
bool IsOnBorder(const QPoint& globalPos) override;
AbstractTabItem* GetSelection() override;
/* (non-Javadoc)
* @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#getContentParent()
*/
QWidget* GetContentParent() override;
/* (non-Javadoc)
* @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#setContent(org.blueberry.swt.widgets.Control)
*/
void SetContent(QWidget* newContent) override;
/**
* @return
* @since 3.1
*/
QCTabBar* GetTabFolder();
/**
* @param item
* @param newTitle
* @since 3.1
*/
/* protected */void SetSelectedTitle(const QString& newTitle);
/**
* @param image
* @since 3.1
*/
/* protected */void SetSelectedImage(const QPixmap* image);
using AbstractTabFolder::GetItem;
/* (non-Javadoc)
* @see org.blueberry.ui.internal.presentations.util.AbstractTabFolder#getItem(org.blueberry.swt.graphics.Point)
*/
AbstractTabItem* GetItem(const QPoint& toFind) override;
/**
* @param enabled
* @since 3.1
*/
void EnablePaneMenu(bool enabled) override;
};
}
#endif /* BERRYNATIVETABFOLDER_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/internal/defaultpresentation/berryNativeTabItem.cpp b/Plugins/org.blueberry.ui.qt/src/internal/defaultpresentation/berryNativeTabItem.cpp
index a474ed3c6b..e3a8dfcdae 100755
--- a/Plugins/org.blueberry.ui.qt/src/internal/defaultpresentation/berryNativeTabItem.cpp
+++ b/Plugins/org.blueberry.ui.qt/src/internal/defaultpresentation/berryNativeTabItem.cpp
@@ -1,127 +1,127 @@
/*===================================================================
BlueBerry Platform
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "berryNativeTabItem.h"
#include "berryNativeTabFolder.h"
#include "berryQCTabBar.h"
+#include "berryQtStyleManager.h"
#include
#include
namespace berry
{
NativeTabItem::NativeTabItem(NativeTabFolder* _parent, int index, int flags) :
parent(_parent), style(flags), showClose(true), closeButton(nullptr)
{
parent->GetTabFolder()->insertTab(index, this);
if (this->GetShowClose())
{
parent->GetTabFolder()->setTabButton(index, QTabBar::RightSide, this->GetCloseButton());
this->connect(this->GetCloseButton(), SIGNAL(clicked()), this, SLOT(CloseButtonClicked()));
}
}
void NativeTabItem::CloseButtonClicked()
{
parent->CloseButtonClicked(this);
}
QRect NativeTabItem::GetBounds()
{
int index = parent->IndexOf(this);
QTabBar* folder = parent->GetTabFolder();
QRect localRect = folder->tabRect(index);
QPoint topLeft = localRect.topLeft();
QPoint bottomRight = localRect.bottomRight();
QPoint globalTopLeft = folder->mapToGlobal(topLeft);
QPoint globalBottomRight = folder->mapToGlobal(bottomRight);
return QRect(globalTopLeft, globalBottomRight);
}
void NativeTabItem::SetInfo(const PartInfo& info)
{
QTabBar* widget = parent->GetTabFolder();
int index = parent->IndexOf(this);
if (widget->tabText(index) != info.name)
{
widget->setTabText(index, info.name);
}
if (widget->tabToolTip(index) != info.toolTip)
{
widget->setTabToolTip(index, info.toolTip);
}
if (widget->tabIcon(index).cacheKey() != info.image.cacheKey())
{
widget->setTabIcon(index, info.image);
}
}
bool NativeTabItem::GetShowClose() const
{
return ((style & Constants::CLOSE) && showClose);
}
void NativeTabItem::SetShowClose(bool close)
{
showClose = close;
}
QWidget* NativeTabItem::GetCloseButton()
{
if (!closeButton)
- {
- QIcon iconCloseTab( ":/org.blueberry.ui.qt/tab_close_grey.svg" );
- iconCloseTab.addFile(":/org.blueberry.ui.qt/tab_close_grey_active.svg", QSize(), QIcon::Active);
+ {
+ QIcon iconCloseTab = QtStyleManager::ThemeIcon(QStringLiteral(":/org.blueberry.ui.qt/tab_close.svg"));
closeButton = new QToolButton(parent->GetControl());
closeButton->setObjectName("TabCloseButton");
closeButton->setContentsMargins(0, 0, 0, 0);
closeButton->setFixedSize(12,12);
closeButton->setIcon(iconCloseTab);
closeButton->setAutoRaise(true);
}
return closeButton;
}
void NativeTabItem::Dispose()
{
QTabBar* widget = parent->GetTabFolder();
int index = parent->IndexOf(this);
widget->removeTab(index); // this calls QCTabBar::tabRemoved
}
Object::Pointer NativeTabItem::GetData()
{
return data;
}
void NativeTabItem::SetData(Object::Pointer d)
{
this->data = d;
}
}
diff --git a/Plugins/org.blueberry.ui.qt/src/internal/util/berryAbstractTabFolder.h b/Plugins/org.blueberry.ui.qt/src/internal/util/berryAbstractTabFolder.h
index 756e7c4601..7a2e6b6ac9 100755
--- a/Plugins/org.blueberry.ui.qt/src/internal/util/berryAbstractTabFolder.h
+++ b/Plugins/org.blueberry.ui.qt/src/internal/util/berryAbstractTabFolder.h
@@ -1,265 +1,207 @@
/*===================================================================
BlueBerry Platform
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef BERRYABSTRACTTABFOLDER_H_
#define BERRYABSTRACTTABFOLDER_H_
#include
#include
#include "berryPartInfo.h"
#include "berryTabFolderEvent.h"
class QWidget;
namespace berry
{
class AbstractTabFolder
{
public:
Message1 tabFolderEvent;
private:
- // Control toolbar;
int state;
int activeState;
- // Listener menuListener = new Listener() {
- // /* (non-Javadoc)
- // * @see org.blueberry.swt.widgets.Listener#handleEvent(org.blueberry.swt.widgets.Event)
- // */
- // public void handleEvent(Event event) {
- // Point globalPos = new Point(event.x, event.y);
- // handleContextMenu(globalPos, event);
- // }
- // };
-
- // Listener dragListener = new Listener() {
- // public void handleEvent(Event e) {
- // Point globalPos = ((Control)e.widget).toDisplay(e.x, e.y);
- // handleDragStarted(globalPos, e);
- // }
- // };
-
- // MouseListener mouseListener = new MouseAdapter() {
- //
- // // If we single-click on an empty space on the toolbar, move focus to the
- // // active control
- // public void mouseDown(MouseEvent e) {
- // Point p = ((Control)e.widget).toDisplay(e.x, e.y);
- //
- // handleMouseDown(p, e);
- // }
- //
- //
- // // If we double-click on the toolbar, maximize the presentation
- // public void mouseDoubleClick(MouseEvent e) {
- // Point p = ((Control)e.widget).toDisplay(e.x, e.y);
- //
- // handleDoubleClick(p, e);
- // }
- // };
-
-
public:
AbstractTabFolder();
virtual ~AbstractTabFolder();
virtual QSize ComputeSize(int widthHint, int heightHint) = 0;
virtual AbstractTabItem* Add(int index, int flags) = 0;
virtual void Move(int from, int to) = 0;
virtual QWidget* GetContentParent() = 0;
virtual void SetContent(QWidget* newContent) = 0;
virtual QList GetItems() = 0;
virtual AbstractTabItem* GetSelection() = 0;
virtual void SetSelection(AbstractTabItem* toSelect) = 0;
virtual void SetSelectedInfo(const PartInfo& info) = 0;
virtual void EnablePaneMenu(bool enabled) = 0;
virtual void SetActive(int activeState);
virtual int GetActive();
/**
* Returns the location where the pane menu should be opened when activated
* by a keyboard shortcut (display coordinates)
*
* @return the location for the pane menu (display coordinates)
* @since 3.1
*/
virtual QPoint GetPaneMenuLocation();
/**
* Returns the location where the part list should be opened when activated
* by a keyboard shortcut (display coordinates)
*
* @return the location for the part list (display coordinates)
* @since 3.1
*/
virtual QPoint GetPartListLocation();
/**
* Returns the location where the pane menu should be opened when activated
* by a keyboard shortcut (display coordinates)
*
* @return the location for the pane menu (display coordinates)
* @since 3.1
*/
virtual QPoint GetSystemMenuLocation();
- // /**
- // * Returns the parent composite that should be used for creating the toolbar.
- // * Any control passed into setToolbar must have this composite as its parent.
- // *
- // * @return the parent composite that should be used for creating the toolbar
- // *
- // * @since 3.1
- // */
- // virtual QWidget* GetToolbarParent() = 0;
-
/**
* Returns the main control for this folder.
*
* @return the main control for the folder
* @since 3.1
*/
virtual QWidget* GetControl() = 0;
virtual AbstractTabItem* GetItem(int idx);
virtual AbstractTabItem* GetItem(const QPoint& toFind);
virtual AbstractTabItem* FindItem(Object::Pointer dataToFind);
/**
* Returns the index of the given item, or -1 if the given item is
* not found in this tab folder. Subclasses should override this if
* the underlying SWT widget has an equivalent method
*
* @param item item to find
* @return the index of the given item or -1
*/
virtual int IndexOf(AbstractTabItem* item);
virtual int GetItemCount();
/**
* Sets the current state for the folder
*
* @param state one of the IStackPresentationSite.STATE_* constants
*/
virtual void SetState(int state);
/**
* Returns the title area for this control (in the control's coordinate system)
*
* @return
*/
virtual QRect GetTabArea() = 0;
/**
* Called when the tab folder's shell becomes active or inactive. Subclasses
* can override this to change the appearance of the tabs based on activation.
*
* @param isActive
*/
virtual void ShellActive(bool isActive);
virtual void Layout(bool flushCache);
virtual void SetTabPosition(int tabPosition);
virtual int GetTabPosition();
virtual int GetState();
/**
* Returns true iff the given point is on the border of the folder.
* By default, double-clicking, context menus, and drag/drop are disabled
* on the folder's border.
*
* @param toTest a point (display coordinates)
* @return true iff the point is on the presentation border
* @since 3.1
*/
virtual bool IsOnBorder(const QPoint& toTest);
/**
* Set the folder to visible. This can be extended to propogate the
* visibility request to other components in the subclass.
*
* @param visible
* true
- the folder is visible.
* @since 3.2
*/
virtual void SetVisible(bool visible);
/**
* Cause the folder to hide or show its
* Minimize and Maximize affordances.
*
* @param show
* true
- the min/max buttons are visible.
* @since 3.3
*/
virtual void ShowMinMax(bool show);
protected:
friend class PresentablePartFolder;
void FireEvent(TabFolderEvent::Pointer e);
void FireEvent(int id);
void FireEvent(int id, AbstractTabItem* w);
void FireEvent(int id, AbstractTabItem* w, const QPoint& pos);
- // void attachSlots(QWidget* theControl) {
- // theControl.addListener(SWT.MenuDetect, menuListener);
- // theControl.addMouseListener(mouseListener);
- //
- // //TODO DnD
- // //PresentationUtil.addDragListener(theControl, dragListener);
- //
- // }
-
-
void HandleContextMenu(const QPoint& displayPos);
void HandleMousePress(const QPoint& displayPos);
void HandleDoubleClick(const QPoint& displayPos);
void HandleDragStarted(const QPoint& displayPos);
};
}
#endif /* BERRYABSTRACTTABFOLDER_H_ */