Please test this with your style. Widget handle still needs some love...
ui.topicLineEdit->hide();
ui.topicLineEdit->installEventFilter(this);
ui.topicLabel->show();
ui.topicLineEdit->hide();
ui.topicLineEdit->installEventFilter(this);
ui.topicLabel->show();
+ setContentsMargins(0,0,0,0);
+ parent->setMinimumHeight(layout()->sizeHint().height() + 2*qApp->style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin));
}
void TopicWidget::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) {
}
void TopicWidget::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) {
ui.topicEditButton->hide();
ui.topicLineEdit->show();
ui.topicLineEdit->setFocus();
ui.topicEditButton->hide();
ui.topicLineEdit->show();
ui.topicLineEdit->setFocus();
+
+ setFixedHeight(layout()->sizeHint().height());
+ // Update the dock widget too, else it won't resize in all styles... FIXME try to sanitize this
+ qobject_cast<QWidget *>(parent())->setMinimumHeight(height() + 2*qApp->style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin));
+ qobject_cast<QWidget *>(parent())->adjustSize();
}
void TopicWidget::switchPlain() {
}
void TopicWidget::switchPlain() {
ui.topicLabel->show();
ui.topicEditButton->show();
ui.topicLineEdit->setText(_topic);
ui.topicLabel->show();
ui.topicEditButton->show();
ui.topicLineEdit->setText(_topic);
+ setFixedHeight(layout()->sizeHint().height());
+ // Update the dock widget too, else it won't resize in all styles... FIXME try to sanitize this
+ qobject_cast<QWidget *>(parent())->setMinimumHeight(height() + 2*qApp->style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin));
+ qobject_cast<QWidget *>(parent())->adjustSize();
}
// filter for the input widget to switch back to normal mode
}
// filter for the input widget to switch back to normal mode
- <width>611</width>
- <height>36</height>
+ <width>644</width>
+ <height>35</height>
</rect>
</property>
<property name="sizePolicy" >
</rect>
</property>
<property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="windowTitle" >
<string>Form</string>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
- <layout class="QHBoxLayout" >
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <property name="sizeConstraint" >
+ <enum>QLayout::SetDefaultConstraint</enum>
+ </property>
<property name="margin" >
<property name="margin" >
</property>
<item>
<widget class="TopicLabel" name="topicLabel" >
</property>
<item>
<widget class="TopicLabel" name="topicLabel" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
- <enum>QFrame::Raised</enum>
+ <enum>QFrame::Plain</enum>
</property>
</widget>
</item>
<item>
</property>
</widget>
</item>
<item>
- <widget class="ClearableLineEdit" name="topicLineEdit" />
+ <widget class="ClearableLineEdit" name="topicLineEdit" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frame" >
+ <bool>true</bool>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ </widget>
</item>
<item>
<widget class="ClickableLabel" name="topicEditButton" >
</item>
<item>
<widget class="ClickableLabel" name="topicEditButton" >
#include "verticaldock.h"
#include "verticaldock.h"
#include <QPainter>
#include <QDebug>
#include <QPainter>
#include <QDebug>
}
QSize VerticalDockTitle::minimumSizeHint() const {
}
QSize VerticalDockTitle::minimumSizeHint() const {
}
void VerticalDockTitle::paintEvent(QPaintEvent *event) {
}
void VerticalDockTitle::paintEvent(QPaintEvent *event) {
if(rect().isValid() && rect().height() > minimumSizeHint().height()) {
for(int i = 0; i < 2; i++) {
if(rect().isValid() && rect().height() > minimumSizeHint().height()) {
for(int i = 0; i < 2; i++) {
- QPoint topLeft = rect().topLeft() + QPoint(3 + i*2, 5);
- QPoint bottomRight = rect().topLeft() + QPoint(3 + i*2, rect().height() - 5);
+ QPoint topLeft = rect().topLeft() + QPoint(3 + i*2, 2);
+ QPoint bottomRight = rect().topLeft() + QPoint(3 + i*2, rect().height() - 2);
qDrawShadeLine(&painter, topLeft, bottomRight, palette());
}
}
qDrawShadeLine(&painter, topLeft, bottomRight, palette());
}
}
// ==============================
// Vertical Dock
// ==============================
// ==============================
// Vertical Dock
// ==============================
: QDockWidget(parent, flags)
{
setDefaultTitleWidget();
: QDockWidget(parent, flags)
{
setDefaultTitleWidget();
+ setContentsMargins(0, 0, 0, 0);
}
void VerticalDock::setDefaultTitleWidget() {
}
void VerticalDock::setDefaultTitleWidget() {