Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • [SOLVED] Adding widgets to a layout inside it's own constructor

    3
    0 Votes
    3 Posts
    3k Views
    BilbonSacquetB
    In general the use of 'own/this' function in the constructor is only 'not sure' in C++ only if you are using virtual. The class is always fully constructed regarding itself and parents (inheritenance) but not from of the point of view of a possible child which inherits of you, because this one is not created. Mainly you should never call a virtual from this constructor or at least make sur that you are on you level: this->Note::addWidget(...); Now for the philosphy part: constructing widget in the constructor of a widget is not really a problem, it's the role of the constructor to 'construct' object and to link them.
  • Cached behaviour with QSql* ?

    3
    0 Votes
    3 Posts
    3k Views
    J
    Thanks for the link. Finally I just dig into QODBCResult and change a little the behaviour. I modify QODBCResult::data(int) and QODBCResult::fetch(int) (also deleting fetchNext() and fetchPrevious(), since I won't need any forward only query). I add a QList<QVariant> buffer, where I store my rows when they are requested. It's almost the same behaviour as default (I cache the whole row, not only the needed columns as Qt). My app take up to 38-40 Mbs in memory for 22k rows / 55 columns of text and floats in cache. GUI seems as fluent as before with a good connection. I may post a suggestion on Jira later, asking for cached results. Because on a slow connection the GUI is just freezed all the time.
  • A quick question about Qt Browser example

    4
    0 Votes
    4 Posts
    3k Views
    R
    [quote author="mprakash" date="1321384645"]Unfortunately it does not :( i m on Mac by the way on 64bit[/quote] Sorry, I tested this on Win7 and ArchLinux (all x64) and all worked fine. Maybe someone have the answer, will wait.
  • [SOLVED] Scrolling to a particular line number in the QTextBrowser

    5
    0 Votes
    5 Posts
    5k Views
    A
    http://stackoverflow.com/questions/3547185/scroll-qtextbrowser-to-the-top This helped me. Thank you to everyone who tried to help me. I appreciate it. @ QTextDocument *document = my_browser->document(); QTextCursor cursor(document); for(int i=0; i<line_number-1 ; i++) { cursor.movePosition(QTextCursor::Down); } cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor); my_browser->setTextCursor(cursor); mainLayout->addWidget(my_browser); setLayout(mainLayout); @
  • QSortFilterProxyModel - additional column does not alternate row color

    8
    0 Votes
    8 Posts
    6k Views
    R
    Did you ever find a solution to this? I need to customize QFileOpen dialog by adding some columns to the list view portion which is related to what you are doing.
  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • Socket gets called twice!?

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • How to hide SVG warnings in console?

    2
    0 Votes
    2 Posts
    4k Views
    D
    Probably by fixing your SVG files? :) Seriously -- reading the Qt source doesn't give any valuable information about suppressing them?
  • How to find duplicates in QStringList

    5
    0 Votes
    5 Posts
    11k Views
    D
    Index-based access for a QList is O(1).
  • 0 Votes
    4 Posts
    5k Views
    F
    Hi, Thanks for the reply. Well, I'm using VS2010 and I've not included the GUI part. Now I've got some workable solution by deriving from the QObject which I need to test further. Yes, its correct that I can't use QWidget if not using GUI.
  • Get the list of available audio devices in Linux

    2
    0 Votes
    2 Posts
    4k Views
    R
    I don't know about Qt (I think no), but you always can use QProcess and the following command: @cat /proc/asound/cards@
  • Valgrind hits in QString?

    5
    0 Votes
    5 Posts
    3k Views
    B
    Great - that is a huge help. (Where to report bugs was my next question). I'll take it there. Cheers, -bms
  • Setting Focus On Table Delegate's Item With Single Click

    2
    0 Votes
    2 Posts
    3k Views
    T
    For the record, I did get this to work. What I did might be heretical or horrible. In a nutshell, I reimplemented editorEvent() and eventFilter() to deal with the mouse click position and set the proper model index for the table view delegate.
  • How to access scene in other class

    3
    0 Votes
    3 Posts
    2k Views
    S
    mainwindow.cpp @ scene=new QGraphicsScene(this); view=new QGraphicsView(this); view->setScene(scene); @ one application is there i created in seperate class which is derived from QDilog....i created one buton in main window.. when i click on that button that dialog will open it contains some file reading thing in that file some rectitem co-ordinates are there...while i was reading the file i want to up date the scene with those rect coordinates.... now tell me how to add rectitem to the scene in that dialog class....is it possible to update the scene in different class??
  • Problem with spinbox?

    11
    0 Votes
    11 Posts
    6k Views
    P
    ya i will try that
  • Problem in getting focus?

    8
    0 Votes
    8 Posts
    4k Views
    F
    If I get it right, the problem seems to be that the spinbox has the focus and not the slider. If that is the case, my first thoughts will be to either give back the focus to the slider after any change in the spinbox propagate the keypress event from the spin box to the slider (so implement a keyevent listener in the spinbox too and send the event to the slider). But in both cases, please note that any widget in the window will have to do the same, or your changes will be vanished from adding new widgets. So, if this is the problem, I suggest to implement the event listener in the main widget and propagate it to the slider. Someone could have better suggestions.
  • 0 Votes
    3 Posts
    2k Views
    F
    Hi, Well, as you said "how you implement your class" , this is excatly what I needed. As I'm new to C++ concepts & Qt, I'm not getting understanding it properly. I've captured that here "11533":http://developer.qt.nokia.com/forums/viewthread/11533/ "scanner" class is the 3rd party dll and it will be calling my COM dll. One basic doubt is like , is that the 3rd party class which I'm deriving will be qurering my COM dll for the fundtion signature, is that for this case its useful. Waiting for reply, Thanks,
  • Initial Steps required for Making the DLL as COM DLL(no GUI based).

    4
    0 Votes
    4 Posts
    3k Views
    F
    Hi, I've removed that error by putting the QWidget class as lafirst tem in the derived class list. @ class CLASSA_EXPORT ClassA : public QWidget, public QAxBindable, public scanner { Q_OBJECT ..... }; @ Thanks,
  • QGLWidget and keyPressEvent

    3
    0 Votes
    3 Posts
    6k Views
    R
    Do you include? @#include "NeHeWidget.h"@
  • Highlighting a QGraphicsItem in a QGraphicsScene

    3
    0 Votes
    3 Posts
    12k Views
    R
    You can reimplement hoveEvents. Somethin like this: highlightItem.h @ #ifndef HIGHLIGHTITEM_H #define HIGHLIGHTITEM_H #include <QGraphicsRectItem> #include <QPen> class HighlightItem : public QGraphicsRectItem { public: explicit HighlightItem(QGraphicsRectItem *parent = 0); protected: void hoverEnterEvent(QGraphicsSceneHoverEvent *event); void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); private: QPen m_pen; }; #endif // HIGHLIGHTITEM_H @ highlightItem.cpp @ #include "highlightitem.h" #include <QPainter> HighlightItem::HighlightItem(QGraphicsRectItem *parent) : QGraphicsRectItem(parent) { setAcceptHoverEvents(true); } void HighlightItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { m_pen.setColor(Qt::cyan); update(); } void HighlightItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { m_pen.setColor(Qt::black); update(); } void HighlightItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { painter->setPen(m_pen); painter->drawRect(rect()); } @