更新代码
This commit is contained in:
@@ -10,7 +10,6 @@ RC_FILE = other/main.rc
|
||||
SOURCES += main.cpp
|
||||
HEADERS += head.h
|
||||
RESOURCES += other/main.qrc
|
||||
CONFIG += warn_off
|
||||
|
||||
INCLUDEPATH += $$PWD
|
||||
INCLUDEPATH += $$PWD/api
|
||||
@@ -24,11 +23,3 @@ include ($$PWD/../core_qui/core_qui.pri)
|
||||
|
||||
INCLUDEPATH += $$PWD/../3rd_qextserialport
|
||||
include ($$PWD/../3rd_qextserialport/3rd_qextserialport.pri)
|
||||
|
||||
unix:!macx {
|
||||
contains(arma7, DEFINES) {
|
||||
INCLUDEPATH += /usr/local/openssl-1.0.2m-h3-gcc-4.9.2/include
|
||||
LIBS += -L/usr/local/openssl-1.0.2m-h3-gcc-4.9.2/lib -lssl -lcrypto
|
||||
LIBS += -L/usr/local/h3_rootfsv -lXdmcp
|
||||
}}
|
||||
|
||||
|
||||
@@ -1,3 +1,25 @@
|
||||
#指定编译产生的文件分门别类放到对应目录
|
||||
MOC_DIR = temp/moc
|
||||
RCC_DIR = temp/rcc
|
||||
UI_DIR = temp/ui
|
||||
OBJECTS_DIR = temp/obj
|
||||
|
||||
#指定编译生成的可执行文件放到源码上一级目录下的bin目录
|
||||
!android {
|
||||
!wasm {
|
||||
DESTDIR = $$PWD/../bin
|
||||
}}
|
||||
|
||||
#把所有警告都关掉眼不见为净
|
||||
CONFIG += warn_off
|
||||
#开启大资源支持
|
||||
CONFIG += resources_big
|
||||
#开启后会将打印信息用控制台输出
|
||||
#CONFIG += console
|
||||
|
||||
#引入全志H3芯片依赖
|
||||
include ($$PWD/h3.pri)
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/iconhelper.h \
|
||||
$$PWD/quiconfig.h \
|
||||
@@ -21,10 +43,5 @@ SOURCES += \
|
||||
$$PWD/quitipbox.cpp \
|
||||
$$PWD/quiwidget.cpp
|
||||
|
||||
!contains(DEFINES, no_qui_qm) {
|
||||
RESOURCES += $$PWD/source/qm.qrc
|
||||
}
|
||||
|
||||
!contains(DEFINES, no_qui_ttf) {
|
||||
RESOURCES += $$PWD/source/ttf.qrc
|
||||
}
|
||||
|
||||
6
core_qui/h3.pri
Normal file
6
core_qui/h3.pri
Normal file
@@ -0,0 +1,6 @@
|
||||
unix:!macx {
|
||||
contains(DEFINES, arma7) {
|
||||
INCLUDEPATH += /usr/local/openssl-1.0.2m-h3-gcc-4.9.2/include
|
||||
LIBS += -L/usr/local/openssl-1.0.2m-h3-gcc-4.9.2/lib -lssl -lcrypto
|
||||
LIBS += -L/usr/local/h3_rootfsv -lXdmcp
|
||||
}}
|
||||
@@ -57,20 +57,24 @@ int QUIHelper::deskHeight()
|
||||
return getScreenRect().height();
|
||||
}
|
||||
|
||||
QWidget *QUIHelper::centerBaseForm = 0;
|
||||
void QUIHelper::setFormInCenter(QWidget *form)
|
||||
{
|
||||
int formWidth = form->width();
|
||||
int formHeight = form->height();
|
||||
QRect rect = getScreenRect();
|
||||
|
||||
//如果=0表示采用系统桌面屏幕为参照
|
||||
QRect rect;
|
||||
if (centerBaseForm == 0) {
|
||||
rect = getScreenRect();
|
||||
} else {
|
||||
rect = centerBaseForm->geometry();
|
||||
}
|
||||
|
||||
int deskWidth = rect.width();
|
||||
int deskHeight = rect.height();
|
||||
QPoint movePoint(deskWidth / 2 - formWidth / 2 + rect.x(), deskHeight / 2 - formHeight / 2);
|
||||
QPoint movePoint(deskWidth / 2 - formWidth / 2 + rect.x(), deskHeight / 2 - formHeight / 2 + rect.y());
|
||||
form->move(movePoint);
|
||||
|
||||
//其他系统自动最大化
|
||||
#ifndef Q_OS_WIN
|
||||
QTimer::singleShot(100, form, SLOT(showMaximized()));
|
||||
#endif
|
||||
}
|
||||
|
||||
QString QUIHelper::appName()
|
||||
@@ -319,8 +323,8 @@ void QUIHelper::setFramelessForm(QWidget *widgetMain, QWidget *widgetTitle,
|
||||
widgetMain->setProperty("form", true);
|
||||
widgetMain->setProperty("canMove", true);
|
||||
|
||||
//根据设定逐个追加属性
|
||||
widgetMain->setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
|
||||
//根据设定逐个追加属性 去掉了 Qt::X11BypassWindowManagerHint
|
||||
widgetMain->setWindowFlags(Qt::FramelessWindowHint);
|
||||
if (tool) {
|
||||
widgetMain->setWindowFlags(widgetMain->windowFlags() | Qt::Tool);
|
||||
}
|
||||
@@ -1206,8 +1210,8 @@ void QUIHelper::initTableView(QTableView *tableView, int rowHeight, bool headVis
|
||||
tableView->horizontalHeader()->setStretchLastSection(stretchLast);
|
||||
//行标题最小宽度尺寸
|
||||
tableView->horizontalHeader()->setMinimumSectionSize(0);
|
||||
//行标题最大高度
|
||||
tableView->horizontalHeader()->setMaximumHeight(rowHeight);
|
||||
//行标题最小高度,等同于和默认行高一致
|
||||
tableView->horizontalHeader()->setFixedHeight(rowHeight);
|
||||
//默认行高
|
||||
tableView->verticalHeader()->setDefaultSectionSize(rowHeight);
|
||||
//选中时一行整体选中
|
||||
|
||||
@@ -10,9 +10,13 @@ public:
|
||||
static int getScreenIndex();
|
||||
static QRect getScreenRect(bool available = true);
|
||||
|
||||
//获取桌面宽度高度+居中显示
|
||||
//获取桌面宽度高度
|
||||
static int deskWidth();
|
||||
static int deskHeight();
|
||||
|
||||
//居中显示窗体
|
||||
//定义标志位指定是以桌面为参照还是主程序界面为参照
|
||||
static QWidget *centerBaseForm;
|
||||
static void setFormInCenter(QWidget *form);
|
||||
|
||||
//程序文件名称+当前所在路径
|
||||
|
||||
@@ -228,6 +228,10 @@ void QUIInputBox::setParameter(const QString &title, int type, int closeSec,
|
||||
} else if (type == 1) {
|
||||
this->txtValue->setVisible(false);
|
||||
this->cboxValue->addItems(defaultValue.split("|"));
|
||||
//回显字符串作为默认的下拉选项
|
||||
if (!placeholderText.isEmpty()) {
|
||||
this->cboxValue->setCurrentIndex(this->cboxValue->findText(placeholderText));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
QUIWidget::QUIWidget(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
this->initControl();
|
||||
this->initForm();
|
||||
QUIHelper::setFormInCenter(this);
|
||||
this->initForm();
|
||||
}
|
||||
|
||||
QUIWidget::~QUIWidget()
|
||||
@@ -66,7 +65,7 @@ QPushButton *QUIWidget::getBtnMenuMax() const
|
||||
return this->btnMenu_Max;
|
||||
}
|
||||
|
||||
QPushButton *QUIWidget::getBtnMenuMClose() const
|
||||
QPushButton *QUIWidget::getBtnMenuClose() const
|
||||
{
|
||||
return this->btnMenu_Close;
|
||||
}
|
||||
@@ -396,6 +395,7 @@ void QUIWidget::setMainWidget(QWidget *mainWidget)
|
||||
//自动设置大小
|
||||
resize(mainWidget->width(), mainWidget->height() + this->widgetTitle->height());
|
||||
this->mainWidget = mainWidget;
|
||||
QUIHelper::setFormInCenter(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
QToolButton *getBtnMenu() const;
|
||||
QPushButton *getBtnMenuMin() const;
|
||||
QPushButton *getBtnMenuMax() const;
|
||||
QPushButton *getBtnMenuMClose() const;
|
||||
QPushButton *getBtnMenuClose() const;
|
||||
|
||||
QString getTitle() const;
|
||||
Qt::Alignment getAlignment() const;
|
||||
|
||||
@@ -10,7 +10,6 @@ RC_FILE = other/main.rc
|
||||
SOURCES += main.cpp
|
||||
HEADERS += head.h
|
||||
RESOURCES += other/main.qrc
|
||||
CONFIG += warn_off
|
||||
|
||||
INCLUDEPATH += $$PWD
|
||||
INCLUDEPATH += $$PWD/api
|
||||
|
||||
@@ -22,7 +22,6 @@ DESTDIR = $$PWD/../bin
|
||||
SOURCES += main.cpp
|
||||
HEADERS += head.h
|
||||
RESOURCES += other/main.qrc
|
||||
CONFIG += warn_off
|
||||
|
||||
INCLUDEPATH += $$PWD
|
||||
INCLUDEPATH += $$PWD/api
|
||||
|
||||
Reference in New Issue
Block a user