Announcement

Collapse
No announcement yet.

The Qt Company Provides A Brief Comment On Open-Source

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    Originally posted by Nth_man View Post
    Maybe berolinux is talking about:

    From https://www.gtk.org:
    Code:
    // Include gtk
    #include <gtk/gtk.h>
    
    static void on_activate (GtkApplication *app) {
    // Create a new window
    GtkWidget *window = gtk_application_window_new (app);
    // Create a new button
    GtkWidget *button = gtk_button_new_with_label ("Hello, World!");
    // When the button is clicked, destroy the window passed as an argument
    g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
    gtk_container_add (GTK_CONTAINER (window), button);
    gtk_widget_show_all (window);
    }
    
    int main (int argc, char *argv[]) {
    // Create a new application
    GtkApplication *app = gtk_application_new ("com.example.GtkApplication",
    G_APPLICATION_FLAGS_NONE);
    g_signal_connect (app, "activate", G_CALLBACK (on_activate), NULL);
    return g_application_run (G_APPLICATION (app), argc, argv);
    }
    versus

    From https://wiki.qt.io/Qt_for_Beginners:
    Code:
    #include <QApplication>
    #include <QPushButton>
    
    int main(int argc, char **argv)
    {
    QApplication app (argc, argv);
    
    QPushButton button ("Hello world !");
    button.show();
    
    return app.exec();
    }
    You're comparing C and C++.

    Comment


    • #22
      Originally posted by TemplarGR View Post
      GTK4 is going to be a very modern toolkit. And if KDE decides to write Plasma 6 on top of GTK4/Gnome technologies, they will have much less workload than today, because the heavy lifting for the infrastructure will be done by Red Hat and the rest of behemoths who support GNOME. KDE will only have to maintain their fork, like the Cinnamon guys do
      On top of that, no need to use Gnome-shell at all. KWin is already a wayland shell. And I doubt there is much Qt inside.

      Comment


      • #23
        > You're comparing C and C++.

        Anyone can go to gtk.org and see the samples they show, no C++ there, but yes Gtk and Rust:

        From gtk.org:

        Code:
        use gio::prelude::*;
        use glib::clone;
        use gtk::prelude::*;
        
        // When the application is launched…
        fn on_activate(application: &gtk::Application) {
        // … create a new window …
        let window = gtk::ApplicationWindow::new(application);
        // … with a button in it …
        let button = gtk::Button::new_with_label("Hello World!");
        // … which closes the window when clicked
        button.connect_clicked(clone!(@weak window => move |_| window.destroy()));
        window.add(&button);
        window.show_all();
        }
        
        fn main() {
        // Create a new application
        let app = gtk::Application::new(Some("com.github.gtk-rs.examples.basic"), Default::default())
        .expect("Initialization failed...");
        app.connect_activate(|app| on_activate(app));
        // Run the application
        app.run(&std::env::args().collect::<Vec<_>>());
        }
        versus

        From https://wiki.qt.io/Qt_for_Beginners:

        Code:
        #include <QApplication>
        #include <QPushButton>
        
        int main(int argc, char **argv)
        {
           QApplication app (argc, argv);
        
           QPushButton button ("Hello world !");
           button.show();
        
           return app.exec();
        }





        Comment


        • #24
          Originally posted by Nth_man View Post
          Maybe berolinux is talking about:
          (...) hello world in C/C++ (...)
          Apart from that those are different languages, the length of a hello world example is irrelevant.

          Maybe it makes more sense to compare e.g. a listview/treeview

          https://developer.gnome.org/gtkmm-tu...amples.html.en

          And these are similar examples in Qt.
          https://code.qt.io/cgit/qt/qtbase.gi...terview?h=5.14
          https://code.qt.io/cgit/qt/qtbase.gi...eemodel?h=5.14

          It is a matter of taste, I guess. I personally like GTKs tree model more than the equivalent functionality in Qt. The file sizes are comparable.

          EDIT:

          An editable tree model in Qt5


          Last edited by oleid; 09 April 2020, 09:40 AM.

          Comment


          • #25
            Originally posted by Nth_man View Post
            > You're comparing C and C++.

            Anyone can go to gtk.org and see the samples they show, no C++ there, but yes Gtk and Rust:
            The only difference is that it would seem you can create a push button in Qt without any window. But who does that in a real application anyway? Again, the size of a hello world app is irrelevant.

            Comment


            • #26
              Originally posted by TemplarGR View Post

              Seriously, enough with the FUD, this is getting ridiculous.... GTK is not inferior, it is just that its scope is limited while Qt contains much more. The other libraries you mention have similar alternatives inside Qt, just because in GNOME they have different names while in the Qt world they are all under the umbrella of Qt doesn't mean they aren't there.

              GTK4 is going to be a very modern toolkit. And if KDE decides to write Plasma 6 on top of GTK4/Gnome technologies, they will have much less workload than today, because the heavy lifting for the infrastructure will be done by Red Hat and the rest of behemoths who support GNOME. KDE will only have to maintain their fork, like the Cinnamon guys do. Look at Cinnamon development, began by a few distro developers and became a full fledged DE easily by just riding on top of vanilla GNOME and doing their own changes on top of it. If the Cinnamon guys can do it, KDE guys can do it better.
              Can we even have server sided menus in Gtk4 ?

              Comment


              • #27
                Originally posted by Nth_man View Post
                > You're comparing C and C++.

                Anyone can go to gtk.org and see the samples they show, no C++ there, but yes Gtk and Rust:

                From gtk.org:

                Code:
                use gio::prelude::*;
                use glib::clone;
                use gtk::prelude::*;
                
                // When the application is launched…
                fn on_activate(application: &gtk::Application) {
                // … create a new window …
                let window = gtk::ApplicationWindow::new(application);
                // … with a button in it …
                let button = gtk::Button::new_with_label("Hello World!");
                // … which closes the window when clicked
                button.connect_clicked(clone!(@weak window => move |_| window.destroy()));
                window.add(&button);
                window.show_all();
                }
                
                fn main() {
                // Create a new application
                let app = gtk::Application::new(Some("com.github.gtk-rs.examples.basic"), Default::default())
                .expect("Initialization failed...");
                app.connect_activate(|app| on_activate(app));
                // Run the application
                app.run(&std::env::args().collect::<Vec<_>>());
                }
                versus

                From https://wiki.qt.io/Qt_for_Beginners:

                Code:
                #include <QApplication>
                #include <QPushButton>
                
                int main(int argc, char **argv)
                {
                QApplication app (argc, argv);
                
                QPushButton button ("Hello world !");
                button.show();
                
                return app.exec();
                }



                Thats because C++ bindings are called Gtkmm:
                https://developer.gnome.org/gtkmm-tu...xample.html.en



                Code:
                #include <gtkmm.h>
                
                int main(int argc, char *argv[]) {
                
                auto app = Gtk::Application::create(argc, argv, "org.gtkmm.examples.base");
                Gtk::Window window; window.set_default_size(200, 200);
                
                return app->run(window);
                }

                Comment


                • #28
                  Originally posted by oleid View Post

                  The only difference is that it would seem you can create a push button in Qt without any window. But who does that in a real application anyway? Again, the size of a hello world app is irrelevant.
                  Strictly from a resource reuse point of view, that's a great bonus: the ability to create common components once, insert them when needed.

                  Comment


                  • #29
                    Originally posted by bug77 View Post

                    Strictly from a resource reuse point of view, that's a great bonus: the ability to create common components once, insert them when needed.
                    I don't see how what you say is related to a Qt widget can be created without any window. Any toolkit can create common components once and insert them when needed.

                    Comment


                    • #30
                      Originally posted by oleid View Post

                      I don't see how what you say is related to a Qt widget can be created without any window. Any toolkit can create common components once and insert them when needed.
                      You just said the GTK version required a window...

                      Comment

                      Working...
                      X