Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • A subclass of QPlainTextEdit with two fonts for two scripts?

    5
    0 Votes
    5 Posts
    3k Views
    S
    I haven't played with this object much yet but you should be able to use the cursor to determine new user input
  • What is qt_startup_hook and how use it?

    2
    0 Votes
    2 Posts
    2k Views
    A
    also i google http://www.koders.com/cpp/fidB1388BB4BB0D095F7B0240654A4F11A08ACA5C13.aspx?s="Reinhart"#L2 link, and crazy about start this example in windows =) but i don't understand how to work with it =(
  • OpenGL window inside of a mainwindow?

    6
    0 Votes
    6 Posts
    5k Views
    W
    Alright, now that works, I'd like to ask about textures vs. glDrawPixels. What I do right now is get a 16-bit greyscale image from a framegrabber, run it through a contrast adjuster, then display that on the screen. The contrast adjust works by taking in a minimum value to display and a maximum value. Anything below the minimum gets set to 0, anything above the maximum gets set to 255, and the rest gets spread linearly between 0 and 255. This is actually a look-up table that just gets recalculated when the user changes the input sliders. It is my understanding that a texture works directly through the video card, whereas glDrawPixels uses the CPU. If I need to push the data through the LUT anyway, would it really help at all to use a texture instead of glDrawPixels? Especially since the video card on the target compute for this program has 512MB of RAM, but our image stacks can easily get to 1GB at a time. Basically, my layout for this is: get an image, stick it in the image stack as a 16-bit unsigned integer array. To display an image, I pull it out of the image stack, push it through the LUT, and display the result. So the way I see it, most of it stays in system memory. I know I don't know much about graphics, though, so I could be totally wrong. I just want to make sure what I do is likely to yield some good results before I invest all the time into doing it.
  • [solved] Change icon using QAnimate or QStateMachine?

    3
    0 Votes
    3 Posts
    2k Views
    J
    Ah ha! Thanks Franz
  • Reading an XML document

    16
    0 Votes
    16 Posts
    14k Views
    M
    [quote author="perego" date="1306948065"]Gostaria de saber se alguem consegue me explicar como eu faço pra baixar ou melhor salvar um arquivo xml via qhttp ou qurl etc[/quote] "I wonder if someone can explain me how can i download or better to save a file via xml or qhttp qurl etc." (from Google Translate)
  • Can't use initial values from a connect()

    13
    0 Votes
    13 Posts
    5k Views
    EddyE
    If i understand you well you want 2 different objects to emit a signal and catch it with a third objects slot. connect scrollbar with y—slice—extract as we explained in another post. 2 ) connect pressing the mouse with y—slice—extract as we explained here you can have several signals connected to the same slot. You can also connect a signal to another signal and so one. All those rules are explained in the signal slots link i gave you earlier.
  • 0 Votes
    3 Posts
    7k Views
    T
    Interesting. I'm working on that. I subclassed QPushButton and implemented resizeEvent() in my new class. It changes the point size of the font with setStyleSheet(). There are side effects. Since I use QtCreator's Designer to build my UI, I told it that the QPushButton is really my subclass, ResizableTextQPushButton. Setting the font size using setStyleSheet() makes the QPushButton forget the color of its text on Maemo and Symbian^3. On Maemo, using setStyleSheet() to set the text and color makes the QPushButton forget its font size. In my application, the button is initially "Don't Panic" in green. When the button is pressed, I change it to "Panic!" in red. That also initiates a series of tasks. When the tasks are completed, I change the text back to green "Don't Panic". I use setStyleSheet() to change both the color and the text of the button. On my N900 w/Maemo, using my subclass of QPushButton, my application opens with white text of the correct size instead of green text. When I push the button, the text changes to red but it's 12-point instead of the larger, button-filling size computed by resizeEvent(). When the tasks are completed, the text color changes to green and it remains at 12-point until I trigger resizeEvent() by rotating the phone. Then it changes the text to the correct size but the color is now white. On my N8 w/Symbian^3, again using my subclass of QPushButton, the application opens with white text of the correct size. When I push the button, the text remains the correct size and the color changes from white to red to green. If I do not rotate the phone, the text remains the right color and size. When I rotate the phone to trigger resizeEvent(), the size is correct but the color changes to white.
  • Debug a plugin [Solved]

    5
    0 Votes
    5 Posts
    4k Views
    L
    [quote author="Franzk" date="1306938845"]You need access to the source for it to work. Maybe "specifying the source directory":http://inside.mines.edu/fs_home/lwiencke/elab/gdb/gdb_49.html of the plug-in could help you further.[/quote] Thanks Franzk, I solved navigating with Qt Creator (while opened main application project) in the source of the plugin, opening the .cpp an putting the breakpoints.
  • Dock Widgets Example Question

    4
    0 Votes
    4 Posts
    3k Views
    W
    Sorry, I am very new to QT. How should the above code (empty central widget) be changed?
  • Code Folding?

    5
    0 Votes
    5 Posts
    6k Views
    D
    Hi, I have modified my class where I implemented Code Folding, and now is not mixed with the Editor and works just as a Sidebar Widget where the Line Number and Folds are displayed... also now support code folding for {}. You can take a look at: http://code.google.com/p/ninja-ide/source/browse/ninja_ide/gui/editor/sidebar_widget.py Regards!
  • Reserved characters URL encoding

    2
    0 Votes
    2 Posts
    3k Views
    U
    Hmm, it seems that I should read documentation more carefully: @QByteArray toPercentEncoding ( const QByteArray & exclude = QByteArray(), const QByteArray & include = QByteArray(), char percent = '%' ) const@
  • 0 Votes
    2 Posts
    4k Views
    A
    AFAIK: An eventloop is designed to be used by only one thread. There is no telling what happens if you start messing with one from different threads. Simply don't do that.
  • Can't insertColumn to an QSqlTableModel

    6
    0 Votes
    6 Posts
    8k Views
    A
    OK, in that case, you have to go with a proxy model. There are several examples of using a proxy model here on the forum to add or modify data. Start out with subclassing QSortFilterProxyModel (Qt 4.7) or QIdentityProxyModel (Qt 4.8) as your starting point. Then, reimplement the columnCount() method to return the columnCount of your base model + 1. Then, you'll need to handle the calls to data(), headerData() and flags() for your new column.
  • QDeclarativeListView

    2
    0 Votes
    2 Posts
    2k Views
    A
    You can retreive the QObject pointers if you need by setting objectName on the views, and querying the context for those names. You can interact with the properties and signals & slots through that interface. Not ideal, but it may be enough for you.
  • Using QLibrary to load a QWidget

    8
    0 Votes
    8 Posts
    8k Views
    G
    And what do you need to use the plug-in? :-) the creator function approach uses the interface technique, which means, you have a header for the interface, but not for the specific implementation. If you use plug-ins (Qt-plugins) and it is enough for you to have the QWidget interface for the class (and the rest only via signal/slot or Q_INVOKEABLE methods) you can use plug-ins. otherwise you also need header files.
  • Code doesnt work

    6
    0 Votes
    6 Posts
    3k Views
    S
    There is an ambiguous 'else' here. put contents of every if in {} always. also you don't need to convert QChar s to QString . they are themselves comparable. I assume needNext is a QString (is not?) try tis code: @ for(int a=0; a<=needNext.count(); a++) { if (needNext[a]!=QChar(' ')) { if (needNext[a]==QChar('}')) { qDebug() <<"1"+ needNext[a]; isClass=true; // a=needNext.count(); // probably you mean: break; } else { //a=needNext.count(); break; qDebug() <<"2"+ needNext[a]; } } }@ If you want to iterate over all characters of a QString, you may want to use a bit more elegant way using iterators: @ QString::ConstIterator i = needNext.begin(); while(i != needNext.end()) { if ( *i !=QChar(' ')) { if ( *i ==QChar('}')) { // ... i++; } @
  • QPainter drawRect on QImage

    5
    0 Votes
    5 Posts
    23k Views
    T
    This is from the 4.6.2 doc: Warning: Painting on a QImage with the format QImage::Format_Indexed8 is not supported I suppose QImage::mono is not supported either since it also uses table look up. -Todd
  • Howto implement the QML "Search Box Example" in the Widget world

    4
    0 Votes
    4 Posts
    5k Views
    C
    Yes, you can use setPlaceholderText() function in QLineEdit :)
  • [SOLVED]Problem with horizontalScrollBar

    4
    0 Votes
    4 Posts
    2k Views
    K
    yeah, it's work, thank You for fast reply
  • 0 Votes
    2 Posts
    4k Views
    D
    You can't move QWebPage to other threads. It uses GUI elements and it must live in the main thread.