Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • Flash on mac

    2
    0 Votes
    2 Posts
    2k Views
    G
    There's an "FAQ answer":http://developer.qt.nokia.com/faq/answer/how_can_i_display_a_flash_file_in_a_qwebview_and_ensure_that_nobody_can_cop for this.
  • QT-Creator's debugger "just stopped" showing QString values

    5
    0 Votes
    5 Posts
    3k Views
    D
    The green 'v' matters only on Mac nowadays. Can you put the contents of the debugger log somewhere, or file a issue at bugreports.qt.nokia.com and attach it there?
  • Qt Making Windows and/or Linux Shutdown using a button.

    4
    0 Votes
    4 Posts
    13k Views
    L
    @ //REBOOT void Converter::reboot() {bool reboot_works = false; bool gnome_power1 = false; bool gnome_power2 = false; bool hal_works = false; QDBusMessage response; QDBusInterface gnomeSessionManager("org.gnome.SessionManager", "/org/gnome/SessionManager", "org.gnome.SessionManager", QDBusConnection::sessionBus()); response = gnomeSessionManager.call("RequestReboot"); if(response.type() == QDBusMessage::ErrorMessage){ if(verbose) qWarning() << "W: " << response.errorName() << ":" << response.errorMessage(); gnome_power1 = QProcess::startDetached("gnome-power-cmd.sh reboot"); gnome_power2 = QProcess::startDetached("gnome-power-cmd reboot"); if(verbose && !gnome_power1 && !gnome_power2) qWarning() << "W: gnome-power-cmd and gnome-power-cmd.sh didn't work"; } else reboot_works = true; QDBusInterface kdeSessionManager("org.kde.ksmserver", "/KSMServer", "org.kde.KSMServerInterface", QDBusConnection::sessionBus()); response = kdeSessionManager.call("logout", 0, 2, 1); if(response.type() == QDBusMessage::ErrorMessage){ if(verbose) qWarning() << "W: " << response.errorName() << ":" << response.errorMessage(); } else reboot_works = true; if(!reboot_works && !gnome_power1 && !gnome_power2){ QDBusInterface powermanagement("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer", "org.freedesktop.Hal.Device.SystemPowerManagement", QDBusConnection::systemBus()); response = powermanagement.call("Reboot"); if(response.type() == QDBusMessage::ErrorMessage){ if(verbose) qWarning() << "W: " << response.errorName() << ":" << response.errorMessage(); } else hal_works = true; } if(!hal_works && !reboot_works && !gnome_power1 && !gnome_power2){ QDBusInterface powermanagement("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", QDBusConnection::systemBus()); response = powermanagement.call("Restart"); if(response.type() == QDBusMessage::ErrorMessage){ if(verbose) qWarning() << "W: " << response.errorName() << ":" << response.errorMessage(); QProcess::startDetached("sudo shutdown -r now"); } }} //HIBERNATE void Converter::hibernate() {bool gnome_power1 = false; bool gnome_power2 = false; bool hal_works = false; QDBusMessage response; gnome_power1 = QProcess::startDetached("gnome-power-cmd.sh hibernate"); gnome_power2 = QProcess::startDetached("gnome-power-cmd hibernate"); if(!gnome_power1 && !gnome_power2 && verbose) qWarning() << "W: gnome-power-cmd and gnome-power-cmd.sh didn't work"; if(!gnome_power1 && !gnome_power2){ QDBusInterface powermanagement("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer", "org.freedesktop.Hal.Device.SystemPowerManagement", QDBusConnection::systemBus()); response = powermanagement.call("Hibernate"); if(response.type() == QDBusMessage::ErrorMessage){ if(verbose) qWarning() << "W: " << response.errorName() << ":" << response.errorMessage(); } else hal_works = true; } if(!hal_works && !gnome_power1 && !gnome_power2){ QDBusInterface powermanagement("org.freedesktop.DeviceKit.Power", "/org/freedesktop/DeviceKit/Power", "org.freedesktop.DeviceKit.Power", QDBusConnection::systemBus()); if(response.type() == QDBusMessage::ErrorMessage){ if(verbose) qWarning() << "W: " << response.errorName() << ":" << response.errorMessage(); } }} //LOCK void Converter::lock() { if(system("gnome-screensaver-command -l") && system("dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock")) QMessageBox::warning(this, "Error", "Unable to lock computer.", QMessageBox::Ok, NULL); }@
  • Table of individually styled buttons

    8
    0 Votes
    8 Posts
    4k Views
    A
    What might work for you, is to put a QGridLayout inside a QScrollArea, and put your buttons in there. That way, your buttons can take the size they need vertically.
  • Clickable URL in About message box

    4
    0 Votes
    4 Posts
    6k Views
    L
    Great :) I am glad that the provided link has helped you to solve the issue.
  • Transparency on QStackedWidget?

    5
    0 Votes
    5 Posts
    6k Views
    S
    Ideally QStackedWidget is used to put mutiple widgets in it but only one widget visible at any time (which is on top of the stack). In your case you need a transparent layer (hence another widget which is transparent), hence I don't see any difference if the underlying widget is QStackedWidget or something else. As mentioned before, go for QGraphicsView to create multiple layers.
  • D-Bus signals cause segmentation faults

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • [Closed] Passing QString's to C external libraries

    Locked
    4
    0 Votes
    4 Posts
    3k Views
    G
    See the "FAQ entry":http://developer.qt.nokia.com/faq/answer/how_can_i_convert_a_qstring_to_char_and_vice_versa Closing this thread for this reason.
  • Crash on QHostAddress::setAddress()... Possibly?

    6
    0 Votes
    6 Posts
    3k Views
    V
    Thank you for your suggestions, guys. Valgrind didn't appear to run well on my system, but I changed a delete socket; to socket->deleteLater(); whilst processing a signal and apparently the problem has gone away (at least nobody complained yet).
  • Kill child process on crash

    12
    0 Votes
    12 Posts
    9k Views
    G
    [quote author="Andre" date="1305296276"]Well... you could of course create some kind of monitoring process to do the cleanup for you in case the main process dies, but I think that is overkill. [/quote] You mean creating a process that check the processes state to cleanup children... ok, also a solution. Here in our software we such stuff but it's a huge product with partly customer apps also running as childs...
  • Custom item delegate with multiple combo boxes

    7
    0 Votes
    7 Posts
    4k Views
    A
    Well, the usage pattern you describe is not very clear (especially the part about changing to text, and then be able to add another block of combo boxes) and, for so far it is clear, looks very strange. I think we're going to need more details on this, and I also think you should perhaps re-think your UI design... There is a reason why what you want is complicated, and that is because it probably is not a good idea.* *) I don't mean to imply that everything that is complicated is a bad idea though
  • [Solved] Closing dialogs doesn't work when mainwindow is closed

    7
    0 Votes
    7 Posts
    4k Views
    E
    Thank you Gerolf, this worked. I give now my Dialog class the mainwindow as a parent.
  • Enabling the button in a QProgressDialog

    3
    0 Votes
    3 Posts
    3k Views
    M
    maybe it's because you do not enter updatePBar() with a value >100? I think you should enable the cancel button on value == 100. anyway Franzk is right ;)
  • Switching QWidgets using QTreeView

    4
    0 Votes
    4 Posts
    2k Views
    F
    [quote author="jazzyeagle" date="1305285111"]Ok, I tried looking at the code, and it seems way more complex than what I wrote, and there are little to no comments throughout to help me understand what exactly they're doing. I'm going to keep looking into it, though, to see if I can't figure it out and get some light bulbs to go off in my head.[/quote] The answer is rather simple. They set up a tree, and each item has a bit of user data that associates each tree item with a widget that is stored in a stacked widget. If an item is selected, the user data is checked, the stacked widget is told to display the associated widget. It is more or less what you do, but the difference lies in the fact that your code has the knowledge 1. hard coded, 2. probably available on multiple places. The QtCreator code only has the knowledge on one location; being where the tree is set up. [quote author="jazzyeagle" date="1305285111"]I'm also not sure what you were talking about with AFAIK. [/quote] http://www.urbandictionary.com/define.php?term=afaik
  • QTableWidget problem

    7
    0 Votes
    7 Posts
    6k Views
    G
    You set row spans in your first method. Be sure to not access any of the cells that are spanned over in the second method.
  • QTableview: Extra Column Space [Solved]

    8
    0 Votes
    8 Posts
    8k Views
    M
    I use delegates now, thank you.
  • QTreeWidget indicator area background color

    2
    0 Votes
    2 Posts
    6k Views
    J
    I'm wondering if it's a deprecation issue... From "QWidget's Class Reference page:":http://doc.trolltech.com/4.7-snapshot/qwidget.html#autoFillBackground-prop autoFillBackground : bool This property holds whether the widget background is filled automatically. If enabled, this property will cause Qt to fill the background of the widget before invoking the paint event. The color used is defined by the QPalette::Window color role from the widget's palette. In addition, Windows are always filled with QPalette::Window, unless the WA_OpaquePaintEvent or WA_NoSystemBackground attributes are set. From "QPalette's Class Reference page:":http://developer.qt.nokia.com/forums/viewthread/5279/ QPalette::Window 10 A general background color. QPalette::Background Window This value is obsolete. Use Window instead. Have you tried setting QPalette::Window instead of QPalette::Background? I'm guessing that is where the problem lays. Once you do that, you shouldn't need to SetBackground on each QTreeWidgetItem, unless of course you're planning on using different colors on each one...
  • Cross Platform Client Server application

    24
    0 Votes
    24 Posts
    9k Views
    G
    If you put the framework bundles into the app bundle, then it runs on a Qt-less mac box too.
  • [Moved] How to add a scrollbar on a QMainWindow with QDockWidgets

    3
    0 Votes
    3 Posts
    3k Views
    D
    Moved. And title shortened a bit (it was toooo long)
  • 0 Votes
    5 Posts
    16k Views
    G
    Just for some nitpicking: the new window actually is a Finder window :-) The same works for (double) clicking on a folder while holding the cmd-key. Ah, BTW: The nice thing is of course, the Qt creates the app bundle for you :)