- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我是 Qt 的新手,但我设法让一些简单的窗口和框架正常工作。我在 64 位 Kubuntu 系统上运行 Eclipse。在 Eclipse 中编辑我的代码后,我运行 qmake 并从命令行生成。
昨天我尝试了 Qt Designer,与在 eclipse 中“硬编码”小部件和按钮相比,它对我来说效果很好。但是,我不会切换到 QT Creator,因为我已经非常习惯 Eclipse。
我的目标是在 Qt Designer 中创建 GUI 并在 Eclipse 中使用生成的代码。
运行 qmake -project、qmake 和 make 为我的主窗口生成一个头文件,其中包含类代码。
但是当我尝试在我的 Eclipse 代码中包含这个头文件时,make 停止并出现错误,因为 g++ 找不到头文件(似乎头文件尚未创建)。
我不得不承认,我仍然对 Qt 构建过程感到困惑。那么,我如何才能通过 Qt Designer 设计我的 GUI 并仍然使用 Eclipse 作为我的编码 IDE?
您好,行李箱
编辑: 我的 Eclipse 项目是一个“空 Makefile 项目”。据我所知,这意味着我必须负责整个构建过程。 Eclipse 不会为我做任何事情。
我没有尝试从 Eclipse 运行“make”,因为 Makefile 必须由 qmake 生成。因此,在 Eclipse 中编辑并保存我的代码后,我运行 qmake 并从命令行生成。
Qmake 感知到有一个.ui 文件并为这个类生成头文件。问题是如果我尝试在 Eclipse 中包含此 header ,则无法编译我的源代码文件。
对我来说,当“make”用我的源代码文件调用 g++ 时,GUI 的标题还没有创建。
那我为什么要这样做呢?好吧,我不想沉迷于 Qt Creator 之类的 IDE。因为这意味着,任何试图编译我的项目的人都需要元信息,例如该特定 IDE 的配置文件或项目特定设置。
在我的 C 项目中,我使用手写的 Makefile,因此您只需要安装 GCC(您通常已经安装)并输入“make”即可。
我正在尝试通过 Qt 项目尽可能接近这一点。
最佳答案
你需要 4 样东西:
=> 关于.ui
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>About</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>A Propos</string>
</property>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
关于窗口 (about.cpp) =>
#include "about.h"
#include "ui_about.h"
About::About(QWidget *parent) : QDialog(parent), ui(new Ui::About)
{
ui->setupUi(this);
}
About::~About()
{
delete ui;
}
(about.h) =>
#ifndef ABOUT_H
#define ABOUT_H
#include <QDialog>
namespace Ui {
class About;
}
class About : public QDialog
{
Q_OBJECT
public:
explicit About(QWidget *parent = 0);
~About();
private:
Ui::About *ui;
};
#endif // ABOUT_H
在 .pro 文件中
SOURCES += about.cpp
HEADERS += about.h
FORMS += about.ui
关于c++ - 在 Eclipse 中使用 Qt Designer 创建的 Qt GUI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13857393/
我正在用power designer创建一个物理模型,我想将默认值添加到我的Mysql表中。 有可能吗,有人加了默认值 ? 谢谢 最佳答案 有可能,我发现“列属性”并不容易 方法如下: 选择表格(单击
关闭。这个问题是 opinion-based 。它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文来回答。 2年前关闭。 Improve t
我正在编写一个采用 Material Design 布局的应用程序,但找不到任何关于如何将对话框动画显示到屏幕上的指南。 这表明盒子应该只是“砰”的一声存在,但这似乎违背了设计的精神,包括动画和触觉。
我做了一个巨大的掠夺,不小心丢失了我的*.cs(设计文件)..我刚刚得到了*.designer文件。 我能否反过来,仅使用 .designer 文件以某种方式创 build 计文件 (*.cs),还是
如果 Google 的关键字规划器向我显示关键字“Web Design [city-name]”获得约 880 次搜索,而“Website Design [city-name]”获得约 620 次搜索
首先,代码: $(document).ready(function() { $('#member_pattern').hide(); $('.add-member').click(function()
大型软件公司之一问了这个问题。我想出了一个简单的解决方案,我想知道其他人对该解决方案有何看法。 You are supposed to design an API and a backend for
在最新的 Material Design 文档 (https://www.google.com/design/spec/what-is-material/elevation-shadows.html#
背景 我正在对从我们的 RDBMS 数据库到 MongoDB 的转换进行原型(prototype)设计。在进行非规范化时,似乎我有两种选择,一种会导致许多(数百万)个小文档,另一种会导致更少(数十万)
Qt Designer (5.11.2) 在选择 QWebEngineView-Widget 时崩溃。 我正在创建一个对话框,以将其作为 .ui 文件包含在 QGIS 3 中。在表单中,我想使用 QW
我直接从 getmdl.io(组件页面)和所有设备(多台 PC、浏览器、手机等)复制代码,汉堡菜单不在标题中居中。我似乎无法隔离 css 中的菜单图标来重新对齐它。 getmdl.io 上的所有组件代
如何为 SPA 动态初始化 materialize design lite (google) 的组件?当我在 View 中动态初始化组件时,JS 没有初始化。正如我已经尝试过使用 componentH
我正在使用 Angular 4 构建一个 Web 应用程序。对于设计,我使用的是 Material Design lite。但是,我想使用 MDL 实现一个交互式轮播,它给我流畅的外观和感觉,并且与我
它看起来像 Polymer Starter Kit包含比 Material Design Lite 更多的组件,并且现在可用。由于两者都是符合 Material Design 理念的 Google 项
我在设置 mdl-textfield 样式时遇到了一些困难。 具体来说,设置 float 标签的大小和颜色,以及按下输入字段后动画的高度和颜色。 实际上,这是我从组件列表中获取的起点。 https:/
所以,好友列表的现代概念: 假设我们有一个名为 Person 的表。现在,那个 Person 需要有很多伙伴(其中每个伙伴也在 person 类中)。构建关系的最明显方法是通过连接表。即 buddyI
如何在导航中创建子菜单项? Link Link Link Link 我不能用 用它。什么是正确的类? 最佳答案 MDL 似乎还没有原生支持子菜单。 然而
我想知道我应该遵循哪些步骤来解决设计自动售货机等问题并提出许多设计文档(如用例、序列图、类图)。是否有任何我可以阅读的来源/链接,其中讨论了如何逐步进行。 谢谢。 最佳答案 我不确定是否有任何普遍接受
早在 10 月份,Kristopher Johnson 就询问了 Accounting Software Design Patterns 他收到了几个答案,但基本上都是一样的,都指向Martin Fo
我一直在为我们的产品开发一些组件,其中之一是基于流布局面板。 我想做的是为它提供一个自定义设计器,但不会丢失其默认设计器 (System.Windows.Forms.Design.FlowLayout
我是一名优秀的程序员,十分优秀!