mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-22 06:14:14 +02:00
dc30b26dab
#1533 stopped the panel shrinking to its title bar when the selection had nothing to edit, so that it would keep the height the user gave it (#1439). Users want the room back for the Collections and Auto numbering panels while nothing is selected (#1566). The panel's layout is back to QLayout::SetMaximumSize, so the empty panel shrinks as before. Just before its last editor goes, the panel keeps the heights of every docked panel in its area; when an editor comes back it gives them back with QMainWindow::resizeDocks, the call a separator drag makes. Giving only this panel its height back fell 35 px short in the test: the neighbours had been split again from their size hints and gave up only part of the room. Test: tst_selectionpanelheight now checks, twice over, that the empty panel shrinks and that selecting an element again brings back the height the user gave it. Without the restore the panel comes back at 470 px instead of 560; on master the empty panel does not shrink. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
59 lines
1.6 KiB
C++
59 lines
1.6 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();
|
|
|
|
Ui::PropertiesEditorDockWidget *ui;
|
|
QList<QPointer<QDockWidget>> m_area_docks;
|
|
QList<int> m_area_heights;
|
|
bool m_restore_pending = false;
|
|
};
|
|
|
|
#endif // SELECTIONPROPERTIESDOCKWIDGET_H
|