当前位置:网站首页>Small demo of QT page layout class
Small demo of QT page layout class
2022-06-22 12:24:00 【Alen. Wang】
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include<QPushButton>
#include<QHBoxLayout>
#include<QtWidgets>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Ui::MainWindow *ui;
QPushButton *pq_returnBtn , *pq_okBtn;
QHBoxLayout* pq_hBoxLayout;
QWidget *widget;
};
#endif // MAINWINDOW_H
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setStyleSheet("QWidget:focus{outline: none;}");
pq_returnBtn = new QPushButton(this);
pq_returnBtn->setStyleSheet("QPushButton{width:1px;height:1px; }"
"QPushButton:focus{width:1px;height:1px; }");
pq_returnBtn->setText("button");
pq_okBtn = new QPushButton(this);
pq_okBtn->setText("ok");
widget = new QWidget();
this->setCentralWidget(widget);
// Layout status bar
pq_hBoxLayout = new QHBoxLayout();
pq_hBoxLayout->addWidget(pq_okBtn);
// Add springs to the horizontal layout
pq_hBoxLayout->addStretch();
pq_hBoxLayout->addWidget(pq_returnBtn);
// The horizontal layout content margin is set to 0
// pq_hBoxLayout->setContentsMargins(20,0,20,0);
widget->setLayout(pq_hBoxLayout);
widget->show();
}
MainWindow::~MainWindow()
{
delete pq_returnBtn;
delete pq_hBoxLayout;
delete widget;
delete ui;
}

边栏推荐
- oracle处理插入重复记录的技巧
- Markov chain, hidden Markov model
- [2022 summer] [leetcode] 31 Next spread
- Endeavouros installation configuration introduction!
- New progress in the construction of meituan's Flink based real-time data warehouse platform
- [安洵杯 2019]iamthinking
- 深入解析Glide源码
- Redis - 5. Jedis operation redis6
- Oracle用户空间统计
- Struggle, programmer -- Chapter 36 the falling flower man is independent and the tiny swift flies
猜你喜欢

OpenCV调用usb摄像头出现“select timeout”解决方法

1961-Check If String Is a Prefix of Array(检查字符串是否为数组前缀)
![[cloud native | kubernetes] Introduction to kubernetes (I)](/img/e0/c75e72fc3636b3de8f5caded19a883.png)
[cloud native | kubernetes] Introduction to kubernetes (I)

In C # development, the third-party components lambdaparser, dynamicexpresso and z.expressions are used to dynamically parse / evaluate string expressions

推荐系统从入门到接着入门

Redis - 11. Cluster

OceanBase数据库助力理想汽车智能生产线 可实现30秒内自动恢复

Take Wei Lai to court. What's Audi's hurry?

Redis - 7、事务操作

MAUI使用Masa blazor组件库
随机推荐
Deadlock found when trying to get lock; try restarting transaction 【MySQL死锁问题解决】
C语言itoa()函数和atoi()函数详解(整数转字符C实现)
chown改变目录的所有者、所属组失败的诡异问题
oracle expdp导出之query转义问题
隐形交通指挥员:浅述城市轨交信号系统
[WMCTF2020]Make PHP Great Again 2.0
JMeter generates test reports
Comparison between channel and lock in go question bank · 10
[an Xun cup 2019]iamthinking
[lihongyi] notes on deep learning of machine learning -- Introduction to training model clearance
Redis - 8、持久化之RDB(Redis DataBase)
增长知识网
磁盘rejecting I/O to offline device故障导致4TB生产数据库无法访问
Messari年度报告-2021
Numpy库常用功能 合并
重磅直播|BizDevOps:数字化转型浪潮下的技术破局之路
论文解读——Factorization Meets the Neighborhood: a Multifaceted Collaborative Filtering Model
[cloud native | kubernetes] Introduction to kubernetes (I)
[安洵杯 2019]iamthinking
Redis - 7、事務操作