Announcement

Collapse
No announcement yet.

Strange Qt problems in Kubuntu

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Strange Qt problems in Kubuntu

    Hi!

    I have developed a Qt-based note-pad application called Basqet inspired by KDE Basket but cross platform (http://code.google.com/p/basqet/). Development mostly takes place on my gentoo installation at home or in virtual windows, same goes for testing. At work I use kubuntu with great success.

    In my application, well tested on Gentoo, user can export a note page to html, txt or odf using Qt built export functions. A flaw with Qt calling KDE native file dialogs (reported as error to KDE http://bugs.kde.org/show_bug.cgi?id=210904) messes up my text fields. The workaround is to use Qt native dialogs by sending the option "DontUseNativeDialog") thus use Qt own file dialog.

    The first problem is that on Kubuntu the KDE native dialogs is use regardless of the DontUseNativeDialog. This works as expected on Gentoo and Windows. I use the QFileDialog::getSaveFileName().

    The second problem is that the export-function does not do the work on ODF-export. The resulting document, once opened, is empty (and by the way default associated with the formula editor). In gentoo this works flawless.

    Anyone have a hint to help me out here? The dialog-problem can easily be fixed by using a slightly more complicated way to trigger the dialog. The export to ODF-problem I have no clue. Everything is in platform. Things gets a little better if I download and installs Qt 4.6 from Qt directly. I have not tried to download Qt 4.5.3 directly from Qt but might as well do.

    Regards,
    Erik

    #2
    Re: Strange Qt problems in Kubuntu

    Well, I found out why the export to ODF didn't work. Qt documentation mension Format "ODF" as "Open Document Format" but I found that correct suffix shall be .odt for documents. It seems that .odf is meant for formulas.

    By some reason OpenOffice in Kubuntu cannot open the file while the version (some patchlevels later) in Gentoo can.

    Still there is the problem with the file dialogs.

    // Erik

    Comment


      #3
      Re: Strange Qt problems in Kubuntu

      Erik,
      You posted a problem at around 2:30 AM and 6 hours later your posted your own solution. 8)

      But, I have a question: Do you ever sleep?

      You know you can burn the candle at both ends for only one wick!

      Still there is the problem with the file dialogs.
      I read your bug posting, and the fact that your problem has been comfirmed:
      ------- Comment #3 From Raphael Kubo da Costa 2009-10-19 04:02:02 -------

      I can confirm it here with trunk and Qt's 4.6-stable branch.

      First of all, let's clarify some things: that warning _is_ harmless and is
      related to a deprecated way to create plugins for KDE.

      You seem to use Qt and KDE without debug symbols, so that's all you see when
      QFileDialog uses the environment's native file dialogs (in this case, KDE's).

      Digging through the code, it seems to be caused by a stat done by KFileWidget
      when the dialog is about to be shown -- more specifically,
      kdelibs/kfile/kfilewidget.cpp in lines 603 and 604 (svn rev 1036880).
      That comment was made 3 months ago, just two days after your initial bug post. Costa confirmed that the problem exists when using Qt 4.6 but pins it on an interaction with kfilewidget.cpp. I doubt that Qt 4.5.3, which is what I am using with QtCreator, would change the outcome. That your app runs on Gentoo, which creates a compiled (tuned) environment, suggests that recompile of KDE4 would eliminate your problem. But, that is something you can't ask users to do.

      I also looked at your code and aside from the "odf" misunderstanding, I saw no syntactical errors in your code:
      QString fileName = QFileDialog::getSaveFileName(
      this,
      tr("Export NotePage to File:"),
      QDir::homePath(),
      tr("HTML-Page (*.html);;Open Document Format (*.odf)")
      );
      The problem seems to reside with Kubuntu's implementation of the KDE4 desktop but very few Kubuntu developers visit this forum. Rog131, who creates several apps for the Kubuntu KDE4 desktop, may offer some suggestions, but they would probably be similar to the work-arounds you've already developed.

      Obviously, you are building a dynamic executable. Just out of curiosity, have you tried your app by building it as a static executable?
      "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
      – John F. Kennedy, February 26, 1962.

      Comment


        #4
        Re: Strange Qt problems in Kubuntu

        We Swedes do not sleep, we are vikings you know, going berserk all night, later years we moved from smashing things to smashing bugs and writing a lot of code Or rather, first post was during morning coffee local time and other by lunch. So it is not really that bad. This post is late night (at the country side where I live) or just after diner (city time). I do have adjusted my time settings on the forum.

        Thanks for the answer. I have not tested to build a static linked version. I havent thought of it but it is worth a try. However I do like having shared libraries.
        Considering it I realize I don't know how to build it statically. Interesting. Have to find out.

        As for now I will consider writing a bug of ignoring the DontUseNativeDialog option addressed to Kubuntu. For Basqet I am using another workaround solving the problem until native dialogs can be used. The differences I found between Kubuntu and Gentoo is if this flag is silently ignored (kubuntu) or not (gentoo).

        The odf/odt problem was a bit embarrassing but easy to fix once I found it.

        All this was a bit embarrassing. I was using Kubuntu and Basqet to take notes during a professional meeting at work and got the question if I could share the notes. "Sure" I sad, "I have made this software my self". Then I pressed export and all notes vanished. It really took me by surprise as I was aware of the problem with KDE file-dialogs and thought I had solved it. Monday I will send the notes as I now have a verified working Basqet

        Regards,
        Erik

        Comment

        Working...
        X