mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
Add QScrollArea to configdialog and resize to max_screen
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include <QScrollArea>
|
||||||
#include "configdialog.h"
|
#include "configdialog.h"
|
||||||
#include "configpages.h"
|
#include "configpages.h"
|
||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
@@ -27,6 +28,11 @@
|
|||||||
*/
|
*/
|
||||||
ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
||||||
Machine_info *mymachineinfo= new Machine_info(this);
|
Machine_info *mymachineinfo= new Machine_info(this);
|
||||||
|
//ScrollArea for low screens
|
||||||
|
QScrollArea *scroll = new QScrollArea(this);
|
||||||
|
scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
|
scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
|
|
||||||
// liste des pages
|
// liste des pages
|
||||||
pages_list = new QListWidget();
|
pages_list = new QListWidget();
|
||||||
pages_list -> setViewMode(QListView::IconMode);
|
pages_list -> setViewMode(QListView::IconMode);
|
||||||
@@ -36,31 +42,46 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
|||||||
pages_list -> setIconSize(QSize(128, 128));
|
pages_list -> setIconSize(QSize(128, 128));
|
||||||
}
|
}
|
||||||
pages_list -> setMovement(QListView::Static);
|
pages_list -> setMovement(QListView::Static);
|
||||||
pages_list -> setMinimumWidth(168);
|
pages_list -> setMinimumWidth(168);
|
||||||
pages_list -> setMaximumWidth(168);
|
pages_list -> setMaximumWidth(168);
|
||||||
pages_list -> setSpacing(16);
|
pages_list -> setSpacing(16);
|
||||||
pages_list -> setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
pages_list -> setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
// pages
|
// pages
|
||||||
pages_widget = new QStackedWidget();
|
pages_widget = new QStackedWidget();
|
||||||
|
|
||||||
// boutons
|
// boutons
|
||||||
buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
|
buttons = new QDialogButtonBox(
|
||||||
|
QDialogButtonBox::Ok
|
||||||
|
|QDialogButtonBox::Cancel);
|
||||||
|
|
||||||
|
|
||||||
|
QWidget *viewport = new QWidget(this);
|
||||||
|
scroll->setWidget(viewport);
|
||||||
|
scroll->setWidgetResizable(true);
|
||||||
|
|
||||||
// layouts
|
// layouts
|
||||||
QHBoxLayout *hlayout1 = new QHBoxLayout();
|
QHBoxLayout *hlayout1 = new QHBoxLayout(viewport);
|
||||||
|
// add needed widgets to layout "hlayout1"
|
||||||
hlayout1 -> addWidget(pages_list);
|
hlayout1 -> addWidget(pages_list);
|
||||||
hlayout1 -> addWidget(pages_widget);
|
hlayout1 -> addWidget(pages_widget);
|
||||||
|
|
||||||
QVBoxLayout *vlayout1 = new QVBoxLayout();
|
//add hlayout1 to widget
|
||||||
vlayout1 -> addLayout(hlayout1);
|
viewport->setLayout(hlayout1);
|
||||||
vlayout1 -> addWidget(buttons);
|
|
||||||
setLayout(vlayout1);
|
// Add a layout for QDialog
|
||||||
|
QVBoxLayout *dialog_layout = new QVBoxLayout(this);
|
||||||
|
dialog_layout->addWidget(scroll); // add scroll to the QDialog's layout
|
||||||
|
dialog_layout -> addWidget(buttons);
|
||||||
|
setLayout(dialog_layout);
|
||||||
|
|
||||||
// connexion signaux / slots
|
// connexion signaux / slots
|
||||||
connect(buttons, SIGNAL(accepted()), this, SLOT(applyConf()));
|
connect(buttons, SIGNAL(accepted()), this, SLOT(applyConf()));
|
||||||
connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
|
connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
connect(pages_list, SIGNAL(currentRowChanged(int)), pages_widget, SLOT(setCurrentIndex(int)));
|
connect(pages_list, SIGNAL(currentRowChanged(int)),
|
||||||
|
pages_widget, SLOT(setCurrentIndex(int)));
|
||||||
|
|
||||||
|
resize(mymachineinfo->get_max_screen_width(),
|
||||||
|
mymachineinfo->get_max_screen_height());
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
if (parent) {
|
if (parent) {
|
||||||
|
|||||||
Reference in New Issue
Block a user