如何制作 Linux C++ GUI 应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/647074/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 16:28:27  来源:igfitidea点击:

How to make Linux C++ GUI apps

c++user-interfaceubuntugnome

提问by Kredns

What is the easiest way to make Linux C++ GUI apps? I'm using GNOME and ubuntu 8.10.

制作 Linux C++ GUI 应用程序的最简单方法是什么?我正在使用 GNOME 和 ubuntu 8.10。

回答by Allen

The easiest way is to use an GUI GUI builder.

最简单的方法是使用 GUI GUI 构建器。

Gladefor GTK.

GTK 的Glade

QT Designerfor QT.

QT 设计器

wxDesignerand wxFormBuilderfor wxWidgets.

wxDesignerwxFormBuilder用于wxWidgets

Update: I should mention that these output C++ among many others?

更新:我应该提到这些输出 C++ 等等?

回答by CTT

I personally prefer QT as I prefer working with the signal/slots mechanism and just find it easy to develop applications quickly with it. Some of your other options would be wxWidgets and GTK+.

我个人更喜欢 QT,因为我更喜欢使用信号/插槽机制,并且发现使用它可以轻松快速地开发应用程序。您的其他一些选择是 wxWidgets 和 GTK+。

回答by Ronny

gtkmm is the c++ binding to gtk, it should work fine

gtkmm 是绑定到 gtk 的 C++,它应该可以正常工作

回答by John Nilsson

Just to be clear about the toolkits mentioned so far (GTK+,QT and wxWidgets)

只是要清楚到目前为止提到的工具包(GTK+、QT 和 wxWidgets)

GTK+ is the toolkit used by GNOME

GTK+ 是 GNOME 使用的工具包

QT is the toolkit used by KDE

QT 是 KDE 使用的工具包

wxWidget aims to be an abstraction above those (and others) to be less desktop environment specific.

wxWidget 旨在成为那些(和其他)之上的抽象,以减少桌面环境的特定性。

Another toolkit worh takeing a peek at is EFLthe toolkit used by E17, although the glacier development speed of this desktop environment may put you off, I hear nice things about it's design. Note that some components from the Enlightenment project such as imlib2 has been used for years by other projects.

另一个值得一看的工具包是EFL,E17 使用的工具包,尽管这种桌面环境的冰川开发速度可能会让您望而却步,但我听说它的设计不错。请注意,Enlightenment 项目中的某些组件(例如 imlib2)已被其他项目使用多年。

回答by gbjbaanb

Try QT, it will work on Ubuntu, and has a lot of development tools and documentation behind it.

试试 QT,它可以在 Ubuntu 上运行,并且背后有很多开发工具和文档。

eg a tutorial, or another tutorialor yet another tutorial

例如教程,或另一个教程或另一个教程

回答by Chinmay Kanchi

I suggest Juce. It's elegant, cross-platform, fast, well-written, almost totally bug-free and is identical to the last pixel on every platform it runs on. The number of knownbugs is nearly always zero, since when a bug report is filed, the author drops everything and fixes it! The Registerwrote an article about it a while ago which gives a rather good overview of the library.

我建议Juce。它优雅、跨平台、快速、编写良好、几乎完全没有错误,并且与它运行的每个平台上的最后一个像素相同。已知错误的数量几乎总是零,因为当提交错误报告时,作者会丢弃所有内容并修复它!The Register不久前写了一篇关于它的文章,它对图书馆进行了相当好的概述。

回答by chickenkiller

The easiestway is definitely Ultimate++. I can't tell how awesome it is, you just have to try it and be convinced by yourself. Following is a fullapplication:

最简单的办法无疑是终极++。我不知道它有多棒,你只需要尝试并被自己说服。以下是一个完整的应用程序:

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

class HelloWorld : public TopWindow {
    MenuBar menu;
    StatusBar status;

    void FileMenu(Bar& bar);
    void MainMenu(Bar& bar);
    void About();

public:
    typedef HelloWorld CLASSNAME;

    HelloWorld();
};

void HelloWorld::About()
{
    PromptOK("{{1@5 [@9= This is the]::@2 [A5@0 Ultimate`+`+ Hello world sample}}");
}

void HelloWorld::FileMenu(Bar& bar)
{
    bar.Add("About..", THISBACK(About));
    bar.Separator();
    bar.Add("Exit", THISBACK(Close));
}

void HelloWorld::MainMenu(Bar& bar)
{
    menu.Add("File", THISBACK(FileMenu));
}

HelloWorld::HelloWorld()
{
    AddFrame(menu);
    AddFrame(status);
    menu.Set(THISBACK(MainMenu));
    status = "Welcome to the Ultimate++ !";
}

GUI_APP_MAIN
{
    SetLanguage(LNG_ENGLISH);
    HelloWorld().Run();
}

回答by Stefan Kendall

I can personally vouch for the ease of use of qt in general, as well as linux specific development. CHeck it out :)

我个人可以保证 qt 总体上的易用性,以及 linux 特定的开发。一探究竟 :)