Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • Invoke cut/copy/paste manually on QGraphicsTextItem

    8
    0 Votes
    8 Posts
    4k Views
    M
    Thanks for creating the feature request. I've voted for it.
  • QPixmap from theme to label

    5
    0 Votes
    5 Posts
    3k Views
    A
    Yep, I found a solution: @QPixmap pix=QIcon::fromTheme("dialog-error").pixmap(22);@ Yet, thanks for being kind with the newbies :)
  • Is that bug ?

    5
    0 Votes
    5 Posts
    2k Views
    A
    @ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QtGui> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); QFileSystemModel *dirModel; QFileSystemModel *fileModel; private slots: void on_treeView_clicked(const QModelIndex &index); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H @ and @ #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::~MainWindow() { delete ui; } MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); dirModel = new QFileSystemModel( this ); dirModel->setFilter( QDir::NoDotAndDotDot | QDir::AllDirs ); dirModel->setRootPath( "" ); ui->treeView->setModel( dirModel ); fileModel = new QFileSystemModel( this ); fileModel->setFilter( QDir::NoDotAndDotDot | QDir::Files ); ui->listView->setModel( fileModel ); } void MainWindow::on_treeView_clicked(const QModelIndex &index) { QString str = dirModel->fileInfo( index ).absoluteFilePath(); ui->listView->setRootIndex( fileModel->setRootPath( str ) ); } @ in treeView shown directory and other side of treeView, listView that shown files in dir on selected in treeView ! there is one bug when you active like go to directory ‘a’ . in this directory exist some file and other dirctory you click on one directory in subdirectory of ‘a’ and then again click on ‘a’ directory ! you will see subdirectory break filter and display in listView !!
  • Inconsistent look of widgets in OS X Lion

    3
    0 Votes
    3 Posts
    1k Views
    P
    [quote author="mafiozzi" date="1341661720"]What libraries do you have? I mean it is 4.8.1 or 4.8.2. Some times ago I had the same problem. When I compile my app in Windows it looks fine, but when I compile app in Linux (Debian) it looks awful. So I asked here about that problem and they recommended me to update my libraries http://qt-project.org/forums/viewthread/16819/#84760[/quote] Thanks for the reply. In Linux I use the latest libraries, in Windows and OS X I use 4.8.1. Since in Windows and OS X I use the SDK, I will have to wait for an upgrade, although I doubt this will solve it:-)
  • Memory leaks with QQueue<QByteArray> from different threads

    11
    0 Votes
    11 Posts
    9k Views
    M
    [quote author="goocreations" date="1341655010"]Ok, I've use Valgrind. Seems like there are no "real" leaks. Valgrind reports leaks way beyond Qt, somewhere in the GNU linux libraries.[/quote] Well, this doesn't mean much! After all, the call stack for every memory allocation (including those that are "leaks") will end up in C/C++ or OS library functions. It doesn't mean the cause of the problem is there tough. The problem usually is somewhere "above" in the call hierarchy. So only if the call stack for a memory leak's allocation neither originates from a Qt function nor passes through a Qt function, you can be sure that it's not Qt's fault. In the other case, if you see some Qt-related function somewhere on the call stack, it might be Qt's fault. But it might be as well your application code using the Qt library in the wrong way (e.g. constructing some Qt object but never destroying it). Further investigation will be needed along all the functions on the stack...
  • [solved]QImageReader problem in console app

    3
    0 Votes
    3 Posts
    1k Views
    A
    Holly s... what a shame ;) yeah I had QT -=gui But... I compiled it earlier on Linux without any errors. Strange. :o Thanks a lot.
  • A Blocking Window

    4
    0 Votes
    4 Posts
    1k Views
    M
    No raaghuu, I am trying to making something more or less like cyber software.
  • MouseMoveEvent() how to set the refresh interval?

    5
    0 Votes
    5 Posts
    6k Views
    A
    I think my mousemoveevent is already lightweight because the if condtions are rarely satisfied: @void MatrixW::mouseMoveEvent(QMouseEvent *e) { if(thismove!=none) { int xnew=e->x()/larghcell; int ynew =e->y()/altcell; if((xnew!=xN||ynew!=yN)&&(xnew<size_x && ynew<size_y)) { if (isarelease) { isarelease=false; if (thismove==del) setcell(xN,yN,0); else if (thismove==add) setcell(xN,yN,1); } xN=xnew; yN=ynew; if (thismove==del) setcell(xN,yN,0); else if (thismove==add) setcell(xN,yN,1); update(); } } }@ (thismove!=none) only if the mouse is clicked ((xnew!=xN||ynew!=yN)&&(xnew<size_x && ynew<size_y)) is rarely true each 50-100 ms The good way to do this I think is to start a timer when the mouse was clicked, the timer call each 50-100ms a function like MatrixW::mouseMoveEvent(QMouseEvent *e) where the program can read the muose position. The mouse release event stop the timer. But I don't know how to read the mouse position in the function called by the timer continually read the mouse position would be the same as what I do now (about the slowdowns)
  • [Solved] Qt - What kind of images can qgraphicsview display?

    3
    0 Votes
    3 Posts
    3k Views
    N
    :) perfect, thank you so much!!
  • Setup a QGraphicsView with Bottom Left Coordinate origin ?

    3
    -1 Votes
    3 Posts
    4k Views
    X
    Cool but wouldn't all my Item inside the View been flipped as well ? as if I apply a scale(1,-1) to flip the y direction axis and then the transform to reset the origin . the "space" woulld be upside down ? would I have then to also scale(-1,1) all my childs item so they are the right way around ? I will do some test, I want to try to do it the correct way rather than "a way" that kinda works :) Thanks for your reply Damien
  • Put and animate a progress-bar in QTableView

    1
    0 Votes
    1 Posts
    7k Views
    No one has replied
  • 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.