mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-25 07:24:21 +01:00
bf940a7205
Since #1572 the empty Selection properties panel shrinks to its title bar. When it shares a tab stack with another panel, such as Collections, Qt gives the whole stack the smallest maximum height of its tabs, so the stack could not be resized while nothing was selected and snapped back small on every deselect. The panel now shrinks only when it is not tabbed. While tabbed it keeps the normal size limits and skips remembering and restoring the area heights, which would otherwise bring back heights from before it was tabbed. tst_selectionpanelheight gets a tabbed case: the stack can be made taller with nothing selected, keeps its height through a select and deselect, and the panel shrinks again once untabbed.
61 lines
1.7 KiB
C++
61 lines
1.7 KiB
C++
/*
|
|
Copyright 2006-2026 The QElectroTech Team
|
|
This file is part of QElectroTech.
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef SELECTIONPROPERTIESDOCKWIDGET_H
|
|
#define SELECTIONPROPERTIESDOCKWIDGET_H
|
|
|
|
#include <QDockWidget>
|
|
#include <QPointer>
|
|
|
|
class PropertiesEditorWidget;
|
|
|
|
namespace Ui {
|
|
class PropertiesEditorDockWidget;
|
|
}
|
|
|
|
class PropertiesEditorDockWidget : public QDockWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit PropertiesEditorDockWidget(QWidget *parent = nullptr);
|
|
~PropertiesEditorDockWidget() override;
|
|
|
|
virtual void clear();
|
|
virtual void apply();
|
|
virtual void reset();
|
|
bool addEditor (PropertiesEditorWidget *editor, int index = 0);
|
|
QList<PropertiesEditorWidget *> editors() const;
|
|
bool removeEditor (PropertiesEditorWidget *editor);
|
|
|
|
protected:
|
|
QList <PropertiesEditorWidget *> m_editor_list;
|
|
|
|
private:
|
|
void rememberHeight();
|
|
void restoreHeight();
|
|
void updateSizeConstraint();
|
|
bool isTabbed() const;
|
|
|
|
Ui::PropertiesEditorDockWidget *ui;
|
|
QList<QPointer<QDockWidget>> m_area_docks;
|
|
QList<int> m_area_heights;
|
|
bool m_restore_pending = false;
|
|
};
|
|
|
|
#endif // SELECTIONPROPERTIESDOCKWIDGET_H
|