mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
OP-38 Implemented 'vertical' look for Config plugin, using the existing 'fancytabwidget' from the coreplugin. Updated the fancytabwidget to enable either vertical or horizontal upon creation. Delete your config gadget .o files when recompiling!
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1253 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
1125311083
commit
bdae03209f
@ -27,6 +27,8 @@
|
||||
#include "configgadgetwidget.h"
|
||||
#include "ui_settingswidget.h"
|
||||
|
||||
#include <coreplugin/fancytabwidget.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
#include <QtGui/QWidget>
|
||||
@ -34,11 +36,21 @@
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QPushButton>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
|
||||
|
||||
ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
m_config = new Ui_SettingsWidget();
|
||||
m_config->setupUi(this);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
FancyTabWidget *ftw = new FancyTabWidget(this, true);
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->addWidget(ftw);
|
||||
setLayout(layout);
|
||||
QWidget *qwd = new QWidget;
|
||||
m_config = new Ui_SettingsWidget();
|
||||
m_config->setupUi(qwd);
|
||||
ftw->insertTab(0, qwd,QIcon(":/core/images/pluginicon.png"),QString("RC Input/Output"));
|
||||
|
||||
// Fill in the dropdown menus for the channel RC Input assignement.
|
||||
QStringList channelsList;
|
||||
|
@ -300,18 +300,28 @@ private:
|
||||
// FancyTabWidget
|
||||
//////
|
||||
|
||||
FancyTabWidget::FancyTabWidget(QWidget *parent)
|
||||
FancyTabWidget::FancyTabWidget(QWidget *parent, bool isVertical)
|
||||
: QWidget(parent)
|
||||
{
|
||||
m_tabBar = new FancyTabBar(this);
|
||||
|
||||
m_selectionWidget = new QWidget(this);
|
||||
QHBoxLayout *selectionLayout = new QHBoxLayout;
|
||||
QBoxLayout *selectionLayout;
|
||||
if (isVertical) {
|
||||
selectionLayout = new QVBoxLayout;
|
||||
} else {
|
||||
selectionLayout = new QHBoxLayout;
|
||||
}
|
||||
selectionLayout->setSpacing(0);
|
||||
selectionLayout->setMargin(0);
|
||||
|
||||
Utils::StyledBar *bar = new Utils::StyledBar;
|
||||
QVBoxLayout *layout = new QVBoxLayout(bar);
|
||||
QBoxLayout *layout;
|
||||
if (isVertical) {
|
||||
layout = new QHBoxLayout(bar);
|
||||
} else {
|
||||
layout = new QVBoxLayout(bar);
|
||||
}
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
layout->addWidget(new FancyColorButton(this));
|
||||
@ -319,13 +329,26 @@ FancyTabWidget::FancyTabWidget(QWidget *parent)
|
||||
|
||||
selectionLayout->addWidget(m_tabBar, 1);
|
||||
m_selectionWidget->setLayout(selectionLayout);
|
||||
m_selectionWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
if (isVertical) {
|
||||
m_selectionWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||
} else {
|
||||
m_selectionWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
}
|
||||
|
||||
m_cornerWidgetContainer = new QWidget(this);
|
||||
m_cornerWidgetContainer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
|
||||
if (isVertical) {
|
||||
m_cornerWidgetContainer->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
} else {
|
||||
m_cornerWidgetContainer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
|
||||
}
|
||||
m_cornerWidgetContainer->setAutoFillBackground(false);
|
||||
|
||||
QHBoxLayout *cornerWidgetLayout = new QHBoxLayout;
|
||||
QBoxLayout *cornerWidgetLayout;
|
||||
if (isVertical) {
|
||||
cornerWidgetLayout = new QVBoxLayout;
|
||||
} else {
|
||||
cornerWidgetLayout = new QHBoxLayout;
|
||||
}
|
||||
cornerWidgetLayout->setSpacing(0);
|
||||
cornerWidgetLayout->setMargin(0);
|
||||
cornerWidgetLayout->addStretch();
|
||||
@ -341,12 +364,15 @@ FancyTabWidget::FancyTabWidget(QWidget *parent)
|
||||
vlayout->setMargin(0);
|
||||
vlayout->setSpacing(0);
|
||||
vlayout->addLayout(m_modesStack);
|
||||
vlayout->addWidget(m_selectionWidget);
|
||||
if (!isVertical)
|
||||
vlayout->addWidget(m_selectionWidget);
|
||||
// vlayout->addWidget(m_statusBar); //status bar is not used for now
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->setSpacing(1);
|
||||
if (isVertical)
|
||||
mainLayout->addWidget(m_selectionWidget);
|
||||
mainLayout->addLayout(vlayout);
|
||||
setLayout(mainLayout);
|
||||
|
||||
|
@ -115,7 +115,7 @@ class FancyTabWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FancyTabWidget(QWidget *parent = 0);
|
||||
FancyTabWidget(QWidget *parent = 0, bool isVertical = false);
|
||||
|
||||
void insertTab(int index, QWidget *tab, const QIcon &icon, const QString &label);
|
||||
void removeTab(int index);
|
||||
|
Loading…
x
Reference in New Issue
Block a user