Skip to content

Commit

Permalink
QGridLayoutDemo Project Added
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunny-softdev committed Aug 13, 2020
1 parent e308619 commit 945db55
Show file tree
Hide file tree
Showing 18 changed files with 2,636 additions and 6 deletions.
31 changes: 31 additions & 0 deletions QGridLayoutDemo/QGridLayoutDemo.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11

# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
main.cpp \
widget.cpp

HEADERS += \
widget.h

FORMS += \
widget.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
325 changes: 325 additions & 0 deletions QGridLayoutDemo/QGridLayoutDemo.pro.user

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions QGridLayoutDemo/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "widget.h"

#include <QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
return a.exec();
}
40 changes: 40 additions & 0 deletions QGridLayoutDemo/widget.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include "widget.h"
#include "ui_widget.h"
#include <QGridLayout>

Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);

//Create a Layout
//QGridLayout *layout = new QGridLayout(this);
QGridLayout *layout = new QGridLayout();

//First Row
layout->addWidget(ui->pushButton1,0,0);
layout->addWidget(ui->pushButton2,0,1);
//Span
layout->addWidget(ui->pushButton3,0,2,2,1);

//Second Row
//Span
layout->addWidget(ui->pushButton4,1,0,1,2);
// layout->addWidget(ui->pushButton5,1,1);
// layout->addWidget(ui->pushButton6,1,2);

//Third Row
layout->addWidget(ui->pushButton7,2,0);
layout->addWidget(ui->pushButton8,2,1);
layout->addWidget(ui->pushButton9,2,2);

//Set the layout
setLayout(layout);
}

Widget::~Widget()
{
delete ui;
}

21 changes: 21 additions & 0 deletions QGridLayoutDemo/widget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
Q_OBJECT

public:
Widget(QWidget *parent = nullptr);
~Widget();

private:
Ui::Widget *ui;
};
#endif // WIDGET_H
152 changes: 152 additions & 0 deletions QGridLayoutDemo/widget.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Widget</class>
<widget class="QWidget" name="Widget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>Widget</string>
</property>
<widget class="QPushButton" name="pushButton1">
<property name="geometry">
<rect>
<x>139</x>
<y>54</y>
<width>73</width>
<height>23</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>One</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton2">
<property name="geometry">
<rect>
<x>218</x>
<y>54</y>
<width>72</width>
<height>23</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Two</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton4">
<property name="geometry">
<rect>
<x>139</x>
<y>87</y>
<width>73</width>
<height>23</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Four</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton7">
<property name="geometry">
<rect>
<x>139</x>
<y>120</y>
<width>73</width>
<height>23</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Seven</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton8">
<property name="geometry">
<rect>
<x>218</x>
<y>120</y>
<width>72</width>
<height>23</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Eight</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton9">
<property name="geometry">
<rect>
<x>296</x>
<y>120</y>
<width>72</width>
<height>23</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Nine</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton3">
<property name="geometry">
<rect>
<x>290</x>
<y>50</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Three</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 8
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 1
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
QMAKE_CXX.COMPILER_MACROS = \
QT_COMPILER_STDCXX \
QMAKE_GCC_MAJOR_VERSION \
QMAKE_GCC_MINOR_VERSION \
QMAKE_GCC_PATCH_VERSION
QMAKE_CXX.INCDIRS = \
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++ \
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32 \
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward \
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include \
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed \
C:/Qt/Tools/mingw810_64/x86_64-w64-mingw32/include
QMAKE_CXX.LIBDIRS = \
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0 \
C:/Qt/Tools/mingw810_64/lib/gcc \
C:/Qt/Tools/mingw810_64/x86_64-w64-mingw32/lib \
C:/Qt/Tools/mingw810_64/lib
Loading

0 comments on commit 945db55

Please sign in to comment.