File indexing completed on 2024-04-21 15:05:24

0001 /*
0002     This file is part of the KDE frameworks
0003     SPDX-FileCopyrightText: 2011-2014 Aurélien Gâteau <agateau@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-or-later
0006 */
0007 
0008 #include <kcolumnresizertestapp.h>
0009 
0010 #include <QApplication>
0011 #include <kcolumnresizer.h>
0012 
0013 #include <ui_kcolumnresizertestapp.h>
0014 
0015 Window::Window()
0016 {
0017     m_ui = new Ui_ColumnResizerTestWidget;
0018     m_ui->setupUi(this);
0019 
0020     KColumnResizer *resizer = new KColumnResizer(this);
0021     resizer->addWidgetsFromLayout(m_ui->gridGroupBox1->layout(), 0);
0022     resizer->addWidgetsFromLayout(m_ui->formGroupBox1->layout(), 0);
0023     resizer->addWidgetsFromLayout(m_ui->formGroupBox2->layout(), 0);
0024     resizer->addWidgetsFromLayout(m_ui->gridGroupBox2->layout(), 0);
0025 
0026     connect(m_ui->spinBox, &QSpinBox::valueChanged, this, &Window::updateAdjustableLabel);
0027     updateAdjustableLabel();
0028 }
0029 
0030 Window::~Window()
0031 {
0032     delete m_ui;
0033 }
0034 
0035 void Window::updateAdjustableLabel()
0036 {
0037     QString txt;
0038     txt.fill(QLatin1Char('#'), m_ui->spinBox->value());
0039     m_ui->adjustableLabel->setText(QStringLiteral("Spin me %1:").arg(txt));
0040 }
0041 
0042 int main(int argc, char **argv)
0043 {
0044     QApplication app(argc, argv);
0045     app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
0046 
0047     Window window;
0048     window.show();
0049     return app.exec();
0050 }
0051 
0052 #include "moc_kcolumnresizertestapp.cpp"