Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.7k Topics 457.9k Posts
  • Convert QList<int> to QString

    2
    0 Votes
    2 Posts
    19k Views
    L
    @ QList<int> list; QString string; ... ... ... for(int i=0; i<list.size(); i++) { string += QString::number(list[i]); if(i<list.size()-1) string += "," ; } @
  • Qt QFileDialog -- proper use under OSX

    10
    0 Votes
    10 Posts
    4k Views
    F
    No, sorry. I don't use Lion -- it has broken multi-monitor support, and as I have six monitors, I've no interest in it. Also sandboxing, certificating, etc. Lion is a regression as far as I'm concerned. I use Snow Leopard and Leopard in-house, and the errors I described here were discovered and exist under those: 10.5. and 10.6. Those are 10.6 (Snow Leopard) diagnostics in my post above. What you've managed to do, however, is confirm that the Qt bug is problematic under Lion / 10.7 as well, for which I thank you. :)
  • [Solved] Using nextId() in linear wizard

    3
    0 Votes
    3 Posts
    2k Views
    D
    I figured out why nextId() always returns -1. The reason is that I was using the nextId() in the constructor. Before the QWizardPage being inserted into QWizard, QWizard has no reason to know which page is the next page of current page. It's a stupid mistake. Sorry for disturbance.
  • Direction problem

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • How to prevent changing selection in QtableView, if the data is invalid?

    5
    0 Votes
    5 Posts
    3k Views
    R
    Thanks, I am looking for a similar solution. Since it is a table, and its validation depends on the current column, how to find the column number from the above approach? Or is it possible to similar programming for QtableView?
  • Error because of thread ..

    6
    0 Votes
    6 Posts
    2k Views
    F
    "you will have to use (asynchronous) signals and slots" --> Use Qt::QueuedConnection as the Qt::ConnectionType parameter of QObject::connect(...) parameter, to detach the threads.
  • Upgrade QGraphicsTextItem (and friends) to QGraphicsWidget?

    3
    0 Votes
    3 Posts
    2k Views
    A
    My best idea right now is to use a composition: A QGraphicsWidget containing the item I want. The tricky part is that one essential change notification (boundingRect changes) is missing, which makes things kinda awkward.
  • [solved] Something about listener...

    17
    0 Votes
    17 Posts
    7k Views
    A
    You're right, actually. It was a statement, not a question.
  • Qt .Xresources Equivalent

    4
    0 Votes
    4 Posts
    2k Views
    sierdzioS
    No, they are read at run-time, which actually makes them somewhat slow at times.
  • How to add a default value to QSqlTableModel

    2
    0 Votes
    2 Posts
    2k Views
    L
    There are two possibilites: provide a default value at database level (using a DEFAULT column constraint) provide a default value at code level, by connecting to "QSqlTableModel::primeInsert()":http://doc.qt.nokia.com/4.7-snapshot/qsqltablemodel.html#primeInsert
  • 0 Votes
    6 Posts
    2k Views
    A
    Find the main widget of your application. Usually, an instance is created in your main() function. Usually, it's constructor will have (lots of) stuff like: @ m_lineEdit = new QLineEdit(this); layout->addWidget(m_lineEdit); @ That is where the UI is constructed. moderator note: @ maplesyrup23, could you please edit your first post to give the post a normal title, and put the actual, complete question in the body of your message?
  • Linker error for signal declaration .

    5
    0 Votes
    5 Posts
    7k Views
    M
    Another mistake are your keywords: its not "signal" and "slot" but "signals" and "slots"... Is this really the original source-code? because this shouldn't compile at all, when I try to define a signal with "signal:", I get the following compiler-error: "Not a signal or slot declaration"
  • Problems with running the OpenGL Core Profile tutorial

    4
    0 Votes
    4 Posts
    5k Views
    V
    The tutorial says: "<...> it is required to bind a VAO before setting up the attributes. This behavior is part of the OpenGL 3.3 core profile." Add this in initializeGL before m_shader.setAttributeBuffer: @uint vao; typedef void (APIENTRY _glGenVertexArrays) (GLsizei, GLuint); typedef void (APIENTRY *_glBindVertexArray) (GLuint); _glGenVertexArrays glGenVertexArrays; _glBindVertexArray glBindVertexArray; glGenVertexArrays = (_glGenVertexArrays) QGLWidget::context()->getProcAddress("glGenVertexArrays"); glBindVertexArray = (_glBindVertexArray) QGLWidget::context()->getProcAddress("glBindVertexArray"); glGenVertexArrays(1, &vao); glBindVertexArray(vao);@
  • X Error: BadCursor

    1
    0 Votes
    1 Posts
    3k Views
    No one has replied
  • How to implement transparent pencil tool in Qt? [pic link updated]

    9
    0 Votes
    9 Posts
    9k Views
    L
    [quote author="utcenter" date="1340915293"]Hehe, looks like you discovered accidental art, looking at the resulting pattern. It is either an issue of color indexing or you need to add some more parenthesis to make sure you get a value in the range of 0-255 before you multiply it by the transparency and set it as alpha value. [/quote] But the art also makes me puzzled... I replaced your way of read alpha value from this: @qAbs((int)test.pixel(iX, iY)-255)@ to this: @(255-qGray(test.pixel(iX, iY)))*0.3; // 0.3 is the transparency@ Now everything woks fine^^ Thanks again!
  • Qt, Linux, check if a given user has sudo privileges

    10
    0 Votes
    10 Posts
    18k Views
    napajejenunedk0N
    @ChrisW67: I have tried this solution already. Calling sudo -l requests for sudo password.
  • QEvent and notify()

    5
    0 Votes
    5 Posts
    8k Views
    A
    It is actually the mechamism behind cross-thread signals and slots. However, only use QCoreApplication::postEvent, not the sendEvent variant.
  • Resizing widgets using drag & drop

    2
    0 Votes
    2 Posts
    3k Views
    A
    That isn't standard functionality. It will take quite a bit of programming to get this to work properly.
  • Custom QLineEdit Selection Highlight

    9
    0 Votes
    9 Posts
    7k Views
    A
    [quote author="Plissken" date="1341420919"]I've created a stylesheet to create black line (actually, just the bottom border visible) for text. However, there is a gap between the baseline of the characters and the line itself. Is there anyway to shift the characters to rest right on the line?[/quote] Sure there is: try playing around with the padding. You can try setting the bottom padding to a negative value.
  • Learning Qt Step by step

    12
    0 Votes
    12 Posts
    14k Views
    A
    sorry this topic posted one year ago!!