C++ GUI recommendations?

Pages: 12
While I'm learning all the nuances of C++ I'm looking to start making software ASAP. Was just kind of curious if the vets here have any recommended GUI platforms to begin making programs with?
It's Qt all the way for me. This is by far the best GUI toolkit I had the pleasure to work with.

QtDesigner (GUI editor) and QtLinguist (translator), both of which are totally optional, are awesome tools too.

wxWidgets would be another popular cross-platform option.

Also GTK+, if you are primarily targeting Linux/Unix. IMO, GTK+ still looks/feels a bit "alien" on Windows.

On Windows, do » not« use MFC. It gave me nightmares! Consider .NET (WPF) maybe.
Last edited on
Wait, do you mean like an IDE, or you mean a library that a C++ program can use to create a GUI?
Oh, if you are actually looking for an C++ IDE, then I would definitely recommend Visual Studio, if you are on Windows. On Linux, you may use Eclipse with CDT Plug-in, Codeblocks or even Visual Studio Code.

The purists, of course, go with either vi or Emacs – also known as the endless geek ‘holy war’ ;-)
http://kalyanvarma.net/images/struggle1.gif

(And, on macOS, I think there is no way around XCode)
Last edited on
Mr WallStreet wrote:
Was just kind of curious if the vets here have any recommended GUI platforms to begin making programs with?
Horses for courses. It would probably help if you gave a bit more info about what sort of things you are wanting to do. What platforms are you interested in. Are you planning to be doing open source or wanting to sell your programs.

Learn about software licensing, I haven't looked at Qt licencing recently but that is the main reason I stopped using it. Make sure whatever libraries you want to use fit with your ethical views.
Thanks Kigar! You nailed it. I've heard good things about both Qt and wxWidgets. I think I'll definitely give Qt a try. I also appreciate your response in regards to IDE's.

I'm using Windows so I'll definitely download Visual Studio.

@Grey Wolf, I'm looking to create programs and sell them. Software licensing? Yep, I'll definitely look that up. I'm considering creating an auction software of some sort and selling it to companies in developed countries outside the US. Who knows though.
kigar64551 wrote:
(And, on macOS, I think there is no way around XCode)

Actually, I downloaded an application called TextMate, and I use that for writing code. It can do basically anything you can name– C, C++, Python, Java, HTML, JavaScript, CSS, Bash, C#, Makefile, PHP, Ruby (although why anyone would actually want to use Ruby is beyond me), XML, and many, many more.

All TextMate does is allow you to write and edit code, and run scripts/programs that don't require user input. For more complex stuff that requires user input, as well as compiling and debugging, I use clang++ (or gnu++) and lldb (or gdb) in the terminal.
On a Mac you don't need to use Xcode but there is no real reason not to. XCode Command Line Tools (?) plugin overcomes the Qt interaction and makes the two completely independent of each other.

For licencing see https://www.qt.io/licensing/ and the GNU policy. Basically you can only use the Community Edition of Qt for free software. If you want to go commercial you need the other licensing options from QT and thereby pay them money.

Don't forget Qt Creator as a multi-platform 'IDE', GUI or console/Terminal

Qt is a very powerful best but is a very specialized version of C++ et al even though it can handle standard C++ or a combination of both.

kigar64551 wrote:
(And, on macOS, I think there is no way around XCode)

There's Visual Studio for Mac, though C++ support is not available.
https://visualstudio.microsoft.com/vs/mac/

If you are looking for C++ support there's Visual Studio Code.
https://code.visualstudio.com/

Mr WallStreet wrote:
I'm using Windows so I'll definitely download Visual Studio.

If'n you aren't looking to do cross-platform why not use the native WinAPI support? No need to install additional libraries.

The WinAPI also has multimedia -- graphics, sound and music -- support natively as well.
From previous posts it seems you are a newbie.
Better not to think about GUIs but learn the basics first.
Mr WallStreet, also take a look at Windows App SDK. It has WinUI 3
"The premiere native user interface (UI) framework for Windows desktop apps, including managed apps that use C# and .NET and native apps that use C++ with the Win32 API. WinUI 3 provides consistent, intuitive, and accessible experiences using the latest user interface (UI) patterns."
https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/
If'n you aren't looking to do cross-platform why not use the native WinAPI support? No need to install additional libraries.

The WinAPI also has multimedia -- graphics, sound and music -- support natively as well.


Are you a sadomasochist? Inflicting this upon poor unsuspecting nieve coders?
Are you a sadomasochist? Inflicting this upon poor unsuspecting nieve coders?

Don't like an alternate SDK suggestion that isn't your preferred one? Tough noogies.

Especially since I wasn't the only one who suggested using a Win SDK.
:) :)
Or you can use the curses library, on Windows that would be PDcurses, I believe.

I'll quote Duthomhas here, from 2008:

Duthomhas wrote:
I recommend the Curses library, which works very well on a lot of platforms.

PDCurses Windows, DOS, OS/2...
http://pdcurses.sourceforge.net/

NCurses POSIX platforms (Unix, Linux, OS X...)
http://www.gnu.org/software/ncurses/

Both are highly compatible, and code written for one should work identically for the other. On most Linux systems, and many Unices, ncurses is already installed for you. Failing that apt-get will install it for you.

...

Again, for POSIX platforms, if you have terminfo installed you also have curses installed. If you are on something really ancient that only has termcap it is still worth your while to install ncurses because it will work with whichever of the two terminal databases it finds.

https://www.cplusplus.com/forum/beginner/1988/2/#msg10636

Hope that helps.
Last edited on
That recommendation from Duthomas is about 13 years out of date, a lot of things have changed.

Recently someone in another thread ( http://www.cplusplus.com/forum/beginner/281274/#msg1216638 ) mentioned the notcurses library.

https://www.phoronix.com/scan.php?page=news_item&px=Notcurses-2.4

For that matter there is the nocurses header file that doesn't look to be "does everything including the kitchen sink" bloat and is only about 2 years dated.

https://github.com/LionyxML/nocurses

I really like the supposed ease of header-only.

At first glance it appears to be Win32 capable, but to find out for sure would require testing that I am not willing to do. Being the lazy sod that I am at times.
This nocurses header from github doesn't compile with VS2019
Oh, well, it looked like the nocurses header was Win32 compatible. Lots of #if statements, etc.

Thanks, thmm, for being less lazy than me. :)
@Furry Guy,
you are welcome. I thought I could use it in my own projects so I gave it a try.
One of the issues is that ESC is a #define and with VS needs a space before/after.

This compiles OK with VS2022:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#pragma once

#include <stdio.h>
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
# include <windows.h>
#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) || defined(__linux__)
# ifndef __unix__
#  define __unix__
# endif
# include <sys/ioctl.h>
# include <termios.h>
# include <unistd.h>
#endif

#define ESC    "\x1b"

#define BLACK   0
#define RED     1
#define GREEN   2
#define YELLOW  3
#define BLUE    4
#define MAGENTA 5
#define CYAN    6
#define WHITE   7

#define BLOCK_BLINK     1
#define BLOCK           2
#define UNDERLINE_BLINK 3
#define UNDERLINE       4
#define BAR_BLINK       5
#define BAR             6

#define TRUE    1
#define FALSE   0

struct termsize {
    int cols;
    int rows;
};


static int bg_color = BLACK,
font_color = WHITE,
font_bold = FALSE;


static void wait() {
    while (fgetc(stdin) != '\n');
}


static void clrscr() {
    printf(ESC "[2J" ESC "[?6h");
}


static void gotoxy(int x, int y) {
    printf(ESC "[%d;%dH", y, x);
}


static void setfontcolor(int color) {
    printf(ESC "[3%dm", color);
    font_color = color;
}

static void setbgrcolor(int color) {
    printf(ESC "[4%dm", color);
    bg_color = color;
}


static void setfontbold(int status) {
    printf(ESC "[%dm", status);
    font_bold = status;
    setfontcolor(font_color);
    setbgrcolor(bg_color);
}

static void setunderline(int status) {
    if (status) status = 4;
    printf(ESC "[%dm", status);
    setfontcolor(font_color);
    setbgrcolor(bg_color);
    setfontbold(font_bold);
}

static void setblink(int status) {
    if (status) status = 5;
    printf(ESC "[%dm", status);
    setfontcolor(font_color);
    setbgrcolor(bg_color);
    setfontbold(font_bold);
}

static void settitle(char const* title) {
    printf(ESC"]0;%s\x7", title);
}

static void setcurshape(int shape) {
    // vt520/xterm-style; linux terminal uses ESC[?1;2;3c, not implemented
    printf(ESC "[%d q", shape);
}

static struct termsize gettermsize() {
    struct termsize size;
#ifdef _WIN32
    CONSOLE_SCREEN_BUFFER_INFO csbi;

    GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
    size.cols = csbi.srWindow.Right - csbi.srWindow.Left + 1;
    size.rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
#elif defined(__unix__)
    struct winsize win;
    ioctl(STDOUT_FILENO, TIOCGWINSZ, &win);
    size.cols = win.ws_col;
    size.rows = win.ws_row;
#else
    size.cols = 0;
    size.rows = 0;
#endif
    return size;
}

static int getch() {
#ifdef _WIN32
    HANDLE input = GetStdHandle(STD_INPUT_HANDLE);
    if (input == NULL) return EOF;

    DWORD oldmode;
    GetConsoleMode(input, &oldmode);
    DWORD newmode = oldmode & ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
    SetConsoleMode(input, newmode);
#elif defined(__unix__)
    struct termios oldattr, newattr;
    tcgetattr(STDIN_FILENO, &oldattr);

    newattr = oldattr;
    newattr.c_lflag &= ~(ICANON | ECHO);
    tcsetattr(STDIN_FILENO, TCSANOW, &newattr);
#endif

    int ch = getc(stdin);

#ifdef _WIN32
    SetConsoleMode(input, oldmode);
#elif defined(__unix__)
    tcsetattr(STDIN_FILENO, TCSANOW, &oldattr);
#endif

    return ch;
}

static int getche() {
#ifdef _WIN32
    HANDLE input = GetStdHandle(STD_INPUT_HANDLE);
    if (input == NULL) return EOF;

    DWORD oldmode;
    GetConsoleMode(input, &oldmode);
    DWORD newmode = oldmode & ~ENABLE_LINE_INPUT;
    SetConsoleMode(input, newmode);
#elif defined(__unix__)
    struct termios oldattr, newattr;
    tcgetattr(STDIN_FILENO, &oldattr);

    newattr = oldattr;
    newattr.c_lflag &= ~ICANON;
    tcsetattr(STDIN_FILENO, TCSANOW, &newattr);
#endif

    int ch = getc(stdin);

#ifdef _WIN32
    SetConsoleMode(input, oldmode);
#elif defined(__unix__)
    tcsetattr(STDIN_FILENO, TCSANOW, &oldattr);
#endif

    return ch;
}

static void clrline() {
    printf(ESC "[2K" ESC "E");
}

static void resetcolors() {
    printf(ESC "001b" ESC "[0m");
}


1
2
3
4
5
6
7
#include <cstdio>

#include "ncurses.h"

int main() {

}

Pages: 12