Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • How to set qml listview model in C++

    6
    0 Votes
    6 Posts
    7k Views
    A
    I solved my problem, I was trying to set directly a pointer to the "model" property of the qml listview but it can't be done like this. The solution is to use the QDeclarativeContext : @ QDeclarativeEngine *engine = new QDeclarativeEngine(); QDeclarativeContext context = engine->rootContext(); MyListModel myModel = new MyListModel(); context->setContextProperty("myModelName", myModel); myQMLListView->setProperty("model", context->contextProperty("myModelName")); @
  • Apply QGraphicsBlurEffect to a window

    5
    0 Votes
    5 Posts
    8k Views
    E
    ouch I wasn't applying the effect to the viewport port directly to the QGraphicsView I shall test your way soon thanks
  • [SOLVED]QTextDocument, table and table border width 1px.

    3
    0 Votes
    3 Posts
    11k Views
    S
    thanks for reply. @tableFormat.setBorderMargin(1);@ - there is no setBorderMardin method in the QTextTableFormat :( There is setMargin(qreal) method, but it has no effect :( I found tableFormat.setCellSpacing(0), which make border more thin. "And for the second one: " I set "<table "style"="border:solid 1px;">" but, I can't see any border :(. Can anybody talk me, how to make table with QTextCursor::insertTable if table is a difficult (have a cells with a "rowspan" and "colspan")? I found @QTextTable::mergeCells(int row, int col, int rowspan, int colspan);@
  • [SOLVED] Compiling with qmake

    6
    0 Votes
    6 Posts
    2k Views
    L
    You're welcome. I actually did the same thing when I tried to figure it out for you ;) And don't forget to edit your title to [Solved]
  • Using the value of a double spin box

    6
    0 Votes
    6 Posts
    6k Views
    V
    Your welcome. If you consider your issue solved please set the thread so.
  • [Solved] How to hide a QBoxLayout and all its content?

    8
    0 Votes
    8 Posts
    24k Views
    J
    QDockWidget is what i needed. Thanks.
  • QGraphicsItem - Bounding rect for item, and all children? [solved]

    4
    0 Votes
    4 Posts
    6k Views
    D
    You are welcome. Assistant contains a lot of info, you only need to find it. Please don't forget to mark thread as [solved] (by editing its title)
  • How can i do color labels in QMenu with Qss

    7
    0 Votes
    7 Posts
    6k Views
    R
    I find it: @QMenu{ color: red; }@ Many thanks for your help! Is interesting why so, why developers dont make it is as: @font-color:@
  • Advice about deploying with extra files

    17
    0 Votes
    17 Posts
    6k Views
    EddyE
    Normally you do nothing in the ui header file. Qt generates it for you. Did you alter things there before? If you clean your project it shouldn't be there anymore. Did you delete it in windows explorer? Make sure it's deleted before running qmake and building again
  • [Solved] Qt Main Window resize problem (Linux/Ubuntu 11.04, Gnome)

    9
    0 Votes
    9 Posts
    7k Views
    L
    I figured it out. The painter cant be a pointer (I should have known that). The icon isn't showing at the moment with the updated code, but I'm sure I can figure that out. Thanks again to everybody. EDIT: It worked. Just had to rebuild everything.
  • [Solved] Restrain Height of QHBoxLayout

    5
    0 Votes
    5 Posts
    14k Views
    J
    Apparently the problem was due to the margins of the QHBoxLayout which i had to set with setContentsMargins(0, 0, 0, 0). Thanks. B.
  • QGraphicsView no refreshement

    2
    0 Votes
    2 Posts
    2k Views
    R
    Hello, maybe this will help you @QGraphicsView->setViewportUpdateMode(QGraphicsView::NoViewportUpdate)@ Update: or you can realise this func your self @ void MyGraphicsView::freezePaint(bool freeze) { m_freezePaint = freeze; } void MyGraphicsView::paintEvent ( QPaintEvent * event ) { if (!m_freezePaint) QGraphicsView::paintEvent(event); } @ something like this :-)
  • QClipboard problem

    2
    0 Votes
    2 Posts
    3k Views
    L
    You should be using the standard MIME formats (list "here":http://www.w3schools.com/media/media_mimeref.asp )
  • Qt 4.7 compiling failure with Visual Studio 2010 (win32-msvc2010)

    7
    0 Votes
    7 Posts
    16k Views
    EddyE
    In that case your problem originates elsewhere. I suggest you start a new thread in which you explain exactly what you did and what errors you get.
  • Parsing Text from File

    8
    0 Votes
    8 Posts
    8k Views
    B
    I appreciate the reply. I don't think that what I am trying to do is too overly complicated, just seemed like a good project to dive head first into Qt and C++ with. I'll give it a look. Thanks again
  • Convert ITK pointer to Qt pointer

    5
    0 Votes
    5 Posts
    4k Views
    L
    http://www.itk.org/CourseWare/Training/GettingStarted-IV.pdf (under Qt) And if you need further help: http://www.google.com/#q=qt+itk+adaptor
  • How to check main event loop is running?

    10
    0 Votes
    10 Posts
    13k Views
    G
    [quote author="jesuisbenjamin" date="1307145093"]@ unclewerner & @ Volker: you seem to prefer QTimer to QThread: is there any advantage using one or the other? is QTimer not a thread with a loop?[/quote] Why do it complicated, when there is a simple solution? You can easily shoot yourself into the foot with a QThread, but it's hard with a QTimer. I don't care about the actual implementation of QTimer's singleShot - it just works. But if you prefer to implement a QThread based code with some 10s of lines, compared to a one liner... it's your choice.
  • Custom Event Compression

    6
    0 Votes
    6 Posts
    6k Views
    L
    Well, I personally don't see another solution then, but you might find one. Good luck!
  • QProcess - spawning another process within a process

    2
    0 Votes
    2 Posts
    5k Views
    G
    That's more a subject to bash, not to Qt. You can call bash with -c <command> parameter like this: @ QString command = "bash"; QStringList args; args << "-c" << "dejagnu"; QProcess p(this); p.start(command, args); @
  • How to write something at a specific line of a text file?

    9
    0 Votes
    9 Posts
    8k Views
    T
    I really am impressed with that piece of code! It managed to avoid doing the bit of work required to read/modify/write the file by having somebody else do the same thing. That not only made the program a bit harder to read (who knows sed these days?), it also introduced a buffer overflow. That is something that is really hard to do when using QByteArray or QString, but that was avoided in favor of fixed sized buffers and strcat (together with user provided input and without range checks). I had really thought that kind of error was left behind in the C world. Then this sed invocation is rather interesting. It assumes a very fixed file structure and looks rather fragile in the face of changes to it. The code also assumes that there is a sed in the path of the system (which generally is not the case on windows) and even requires the gnu-version of sed (not available on most non-Linux unixes out there). That might be OK for the use-case, but adds some probably undocumented assumptions about the execution environment and makes the application less portable without any real need. Finally the string conversions are horrible: Assuming avi_outpout->text() returns a QString this is converted from utf16 to utf8 and straight back. Then that variable is converted to latin1 encoded outpout_name2... maybe loosing characters in the process. The file extension it assumed to be ASCII (which might or might not be true, depending on the program and how the extensions can be configured). This mixture of encodings (ASCII, Latin1 and the encoding the source was saved as) is concatenated into one string and the system is expected to execute that, independent of which encoding the system might actually be using. There is a toLocal8Bit() method on QString for a reason. The user input is of course not validated either. "Bobby Tables":http://xkcd.com/327/ is lurking in the bushes. Really, I am truly impressed by that code.