LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-29-2019, 10:38 AM   #1
dangtu
LQ Newbie
 
Registered: Jan 2019
Distribution: Lubuntu, Puppy, Ubuntu
Posts: 14

Rep: Reputation: Disabled
Question How to write GUI program for Linux universe in C++


There are various GUI libraries (even cross-platform) for C++. However, I don't really know how does it work in Linux. As far as I know, Linux family has thing called Desktop Environment. And each distro using different DE. So what GUI lib should I choose to allow my GUI app works on all of these DE?
 
Old 01-29-2019, 11:13 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,869
Blog Entries: 1

Rep: Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870
As a start create some Java applications with GUI.
 
Old 01-29-2019, 11:23 AM   #3
dangtu
LQ Newbie
 
Registered: Jan 2019
Distribution: Lubuntu, Puppy, Ubuntu
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by NevemTeve View Post
As a start create some Java applications with GUI.
I don't want the involving of VM so some languages such as Js, Java, Py will be not in my list at the moment.

Last edited by dangtu; 01-29-2019 at 11:47 AM.
 
Old 01-29-2019, 12:14 PM   #4
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,613
Blog Entries: 19

Rep: Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458
To write GUI apps, you need a widget library. Which one you use depends on what desktop environment you want it to run on. For a Gnome or xfce environment, use gtk2. For a KDE environment, use qt. For a simple window manager, you can use either. In theory, you can also use the Athena widget set Xaw, which was used for the original X apps, but I've heard it's a pig to use. I use gtk myself.
 
1 members found this post helpful.
Old 01-29-2019, 12:37 PM   #5
dangtu
LQ Newbie
 
Registered: Jan 2019
Distribution: Lubuntu, Puppy, Ubuntu
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by hazel View Post
To write GUI apps, you need a widget library. Which one you use depends on what desktop environment you want it to run on. For a Gnome or xfce environment, use gtk2. For a KDE environment, use qt. For a simple window manager, you can use either. In theory, you can also use the Athena widget set Xaw, which was used for the original X apps, but I've heard it's a pig to use. I use gtk myself.
Thanks for the advise. One more question, plz.

Right now I'm using Lubuntu, which has lxde. That means I should use gtk right? Also, if I brought my program to other distro. What will it display? Will it corrupt or display incorrectly? How some app like Firefox can make a matching theme cross-distro?

Last edited by dangtu; 01-29-2019 at 12:39 PM.
 
Old 01-29-2019, 12:47 PM   #6
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,869
Blog Entries: 1

Rep: Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870
SDL would be an option https://www.libsdl.org/
 
Old 01-29-2019, 12:49 PM   #7
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,241

Rep: Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322
Qt and GTK both work in all DEs.
 
Old 01-29-2019, 12:56 PM   #8
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,613
Blog Entries: 19

Rep: Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458
Quote:
Originally Posted by dugan View Post
Qt and GTK both work in all DEs.
They work but they don't necessarily look good.
 
Old 01-29-2019, 12:58 PM   #9
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
^ dugan's right.
Quote:
Originally Posted by dangtu View Post
Right now I'm using Lubuntu, which has lxde. That means I should use gtk right?
yes.
Quote:
Also, if I brought my program to other distro. What will it display? Will it corrupt or display incorrectly?
you will need to test that.
Quote:
How some app like Firefox can make a matching theme cross-distro?
they mostly use their own toolkit.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Ballpoint Universe - Infinite, A Crazy Hand Drawn Action Platformer On Steam For Linux LXer Syndicated Linux News 0 04-07-2014 05:30 PM
LXer: Linux rules the universe by behaving exactly how the user wants LXer Syndicated Linux News 0 03-01-2014 08:30 PM
LXer: Linux Containers: Part 4, Getting to the Universe LXer Syndicated Linux News 0 08-14-2013 03:50 PM
LXer: The Next Universe Sandbox May Support Linux LXer Syndicated Linux News 0 07-15-2013 11:20 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration