Search Results

Search found 1902 results on 77 pages for 'qt contextmenu'.

Page 55/77 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • How to get number of bytes read from QTextStream

    - by user261882
    The following code I am using to find the number of read bytes from QFile. With some files it gives the correct file size, but with some files it gives me a value that is approximatively fileCSV.size()/2. I am sending two files that have same number of characters in it, but have different file sizes link text. Should i use some other objects for reading the QFile? QFile fileCSV("someFile.txt"); if ( !fileCSV.open(QIODevice::ReadOnly | QIODevice::Text)) emit errorOccurredReadingCSV(this); QTextStream textStreamCSV( &fileCSV ); // use a text stream int fileCSVSize = fileCSV.size()); qint64 reconstructedCSVFileSize = 0; while ( !textStreamCSV.atEnd() ) { QString line = textStreamCSV.readLine(); // line of text excluding '\n' if (!line.isEmpty()) { reconstructedCSVFileSize += line.size(); //this doesn't work always reconstructedCSVFileSize += 2; } else reconstructedCSVFileSize += 2; } I know that reading the size of QString is wrong, give me some other solutions if you can. Thank you.

    Read the article

  • Using proxy models

    - by smallB
    I've created Proxy model by subclassing QAbstractProxyModel and connected it as a model to my view. I also set up source model for this proxy model. Unfortunately something is wrong because I'm not getting anything displayed on my listView (it works perfectly when I have my model supplied as a model to view but when I supply this proxy model it just doesn't work). Here are some snippets from my code: #ifndef FILES_PROXY_MODEL_H #define FILES_PROXY_MODEL_H #include <QAbstractProxyModel> #include "File_List_Model.h" class File_Proxy_Model: public QAbstractProxyModel { public: explicit File_Proxy_Model(File_List_Model* source_model) { setSourceModel(source_model); } virtual QModelIndex mapFromSource(const QModelIndex & sourceIndex) const { return index(sourceIndex.row(),sourceIndex.column()); } virtual QModelIndex mapToSource(const QModelIndex & proxyIndex) const { return index(proxyIndex.row(),proxyIndex.column()); } virtual int columnCount(const QModelIndex & parent = QModelIndex()) const { return sourceModel()->columnCount(); } virtual int rowCount(const QModelIndex & parent = QModelIndex()) const { return sourceModel()->rowCount(); } virtual QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const { return createIndex(row,column); } virtual QModelIndex parent(const QModelIndex & index) const { return QModelIndex(); } }; #endif // FILES_PROXY_MODEL_H //and this is a dialog class: Line_Counter::Line_Counter(QWidget *parent) : QDialog(parent), model_(new File_List_Model(this)), proxy_model_(new File_Proxy_Model(model_)), sel_model_(new QItemSelectionModel(proxy_model_,this)) { setupUi(this); setup_mvc_(); } void Line_Counter::setup_mvc_() { listView->setModel(proxy_model_); listView->setSelectionModel(sel_model_); }

    Read the article

  • Is it possible to add a menu bar to a widget

    - by yan bellavance
    I would like to add a QMenuBar to a window of my program (not the QMainWindow) from QtDesigner but I do not see this widget in there and it seems the only way to do this from designer is to use a mainwindow. Would I absolutely need to create this QMenu by hand coding it. Is it possible/ok to instead add a QMainwindow that is actually declared inside my main QMainwindow?

    Read the article

  • How to remove the file which has opened handles?

    - by SKINDER
    PROBLEM HISTORY: Now I use Windows Media Player SDK 9 to play AVI files in my desktop application. It works well on Windows XP but when I try to run it on Windows 7 I caught an error - I can not remove AVI file immediately after playback. The problem is that there are opened file handles exist. On Windows XP I have 2 opened file handles during the playing file and they are closed after closing of playback window but on Windows 7 I have already 4 opened handles during the playing file and 2 of them remain after the closing of playback window. They are become free only after closing the application. QUESTION: How can I solve this problem? How to remove the file which has opened handles? May be exists something like "force deletion"? Thanks.

    Read the article

  • Split text by whitespaces

    - by sterh
    Hi to all. I have text file with some text information and i need to split this text at spaces and all word push into List. I make so: QStringList list = line.split(" "); for (int i = 0; i < list.count(); i++){ table.push_back(list[i]); this->ui->textEdit->setText(list[i]); } In line i have my text. But when i test this code i get all text, but not by the word. Thank you.

    Read the article

  • how to get selected item in pyqt Qmenu

    - by Moayyad Yaghi
    hello is there any way to get the selected item in a qmenu ? i want to bind all items in that list to one function and get the item once user click it . i've been looking for a way to get the item's label or index for 3 days , but couldn't find it . any ideas ? thanks in advance

    Read the article

  • More compact layout

    - by Jesse Aldridge
    In the following code, I'd like to get rid of the margin around the buttons. I'd like to have the buttons stretch all the way to the edge of the frame. How can I do that? import sys from PyQt4.QtGui import * from PyQt4.QtCore import * app = QApplication(sys.argv) window = QWidget() layout = QVBoxLayout() layout.setSpacing(0) window.setLayout(layout) for i in range(2): layout.addWidget(QPushButton()) window.show() app.exec_()

    Read the article

  • Python + PyQt program freezes

    - by DSblizzard
    I wrote PyQt application. After it's start I close it (GUI), but timer don't stops and Python sometimes freezes. Only thing to unfreeze it - Ctrl-C, after which following message appears: Traceback (most recent call last): File "", line 262, in timerEvent KeyboardInterrupt timer don't stops again, and CPython works very slowly. How to avoid this problem?

    Read the article

  • Trouble with QxtGlobalShortcut [solved]

    - by Ockonal
    Hello, i'm trying to set global shortcut for my applcation using QxtGlobalShortcut. Here is my code: QxtGlobalShortcut m_hotkeyHandle; m_hotkeyHandle.setShortcut( QKeySequence("Ctrl+Shift+X") ); m_hotkeyHandle.setEnabled(true); connect( &m_hotkeyHandle, SIGNAL(activated()), this, SLOT(hotkeyPressed()) ); void MainWindow::hotkeyPressed() { QMessageBox::information(this, "Good", "Hot key triggered", "yes", "no"); } But after applcation started i got: QxtGlobalShortcut failed to register: "Ctrl+Shift+X" And my programm doesn't activate after hot key pressing. What should i do? EDIT: There was a bug in Qxt-lib 0.5 with shortcut. I spoke with developer and knew that i just need to update library from dev-branch (0.5.1 is worked).

    Read the article

  • Nesting QDockWidgets

    - by Brent Parker
    Right now I have four customized QDockWidgets on the left side of my application. When you start the application, each one is visible, but very small because of the visibility of each one. I would like for three of the QDockWidgets to nest behind one primary one to give that one priority and the entire left side of the screen. Does anyone know how to tell QDockWidgets to nest when they are created?

    Read the article

  • QProgressBar problem with uploading

    - by rolanddd
    Hey all! I show my code first, then I explain my problem: ... // somewhere in the constructor progressBar = new QProgressBar(this); progressBar-setMinimum(0); progressBar-setMaximum(100); ... connect(&http, SIGNAL(dataSendProgress(int, int)), this, SLOT(updateProgressBar(int, int))); ... void MainWindow::updateProgressBar(int bytesSent, int total) { progressBar-setMaximum(total); progressBar-setValue(bytesSent); } So this is how I try to make my progressBar being updated when I upload a file. The problem is, it won't do the job. When it starts uploading, I set the value of the progress bar to 0, then (thanks to this slot) it won't actually show the progress, but will jump to 100% immediately (even before it finished uploading). I already checked the HTTP Client example, and copied the progress bar part, it is for downloading, and more or less is the same as for uploading but it uses the dataReadProgress signal (needed for downloading) AND it works perfectly. Does anybody know how to solve this for uploading?

    Read the article

  • Buffer Overrun Issues VC++

    - by sijith
    When i execute my code i am getting this error LPTSTR lpBuffer; ::GetLogicalDriveStrings(1024,lpBuffer); while(*lpBuffer != NULL) { printf("%s\n", lpBuffer); // or MessageBox(NULL, temp, "Test", 0); or whatever lpBuffer += lstrlen(lpBuffer)+1; printf("sizeof(lpBuffer) %d\n",lstrlen(lpBuffer)); } OutPut C sizeof(lpBuffer) 3 D sizeof(lpBuffer) 3 E sizeof(lpBuffer) 3 F sizeof(lpBuffer) 0

    Read the article

  • Expected symbol problems with this function declaration

    - by Derek
    I am just getting back into the C programming realm and I am having an issue that I think is linker related. I am using cmake for the first time as well, so that could be adding to my frustration. I have included a third party header file that contains a typedef that my code is trying to use, and it has this line: typedef struct a a_t so my code has a_t *var; //later..... var->member;// this line throws the error which throws the error: dereferencing pointer to incomplete type So am I just missing another include file, or is this a linker issue? I am building this code in QtCreator and using cmake. I can dive on a_t to see that typedef declaration in the included header, but I can't seem to dive on "struct a" itself to see where it's coming from. Thanks

    Read the article

  • What is the correct way to open and close window/dialog?

    - by mree
    I'm trying to develop a new program. The work flow looks like this: Login --> Dashboard (Window with menus) --> Module 1 --> Module 2 --> Module 3 --> Module XXX So, to open Dashboard from Login (a Dialog), I use Dashboard *d = new Dashboard(); d->show(); close(); In Dashboard, I use these codes to reopen the Login if the user closes the Window (by clicking the 'X') closeEvent(QCloseEvent *) { Login *login = new Login(); login->show(); } With a Task Manager opened, I ran the program and monitor the memory usage. After clicking open Dashboard from Login and closing Dashboard to return to Login, I noticed that the memory keeps increasing about 500 KB. It can goes up to 20 MB from 12 MB of memory usage by just opening and closing the window/dialog. So, what did I do wrong here ? I need to know it before I continue developing those modules which will definitely eat more memory with my programming. Thanks in advance.

    Read the article

  • Can I have multiple instance of the mandlebrot example in one program?

    - by yan bellavance
    Basically what I did is I took the Mandlebrot example and have 3 instances of it in my program. So the program would look like a mainwindow that has 3 mandlebrot widgets in it, one besides the other. Is it possible that GDB doesnt support debugging multiple intances of a classe that derives from qthread or is it thread-unsafe to do so? I don't have any problems at run-time but when I put breakpoints in a function called by the QThread run() function I get a segmentation fault. I can clearly see that the function doesn't complete before returning to the breakpoint ie I the program stops at the breakpoint, I step into the lines of codes one by one but after a couple of instructions another thread startS using the function(even though they are different instances).

    Read the article

  • OBject access from different functions in VC++

    - by sijith
    Hi, I have 3 function in my class B. These three function have to access member function of other class A. I did this by creating object of class A in class B constructor and tried to access that object in functions of class B. But its showing error. How can i assess the same object in these three functions. Where i have to create object of class A B::B() { A a; } B:: function() { a.fun(); //fun belongs to class A } B:: function1() { a.fun1(); //fun1 belongs to class A } I am getting error, How can i implement the same where i can access object a in both function.

    Read the article

  • Custom QAction/QMenu for mouse button detection

    - by voodoogiant
    I'm trying to create a popup menu, where I can detect the mouse button that was pressed for a given item. I've created a custom QAction already to build my QMenu, but the triggered signal when the menu item is pressed doesn't provide a QMouseEvent for me to query the button pressed. Also, I'm setting the a status tip for each QAction, which appears in the status bar when I mouse over it, but it stays even after I close the QMenu. Is this normal behavior?

    Read the article

  • c++ - QListWidget

    - by user1889459
    I created a working QListWidget with multiple items, but I can't figure out how to make it user-friendly. It looks like this: 1000 1001 1002 ... But I want it to look like this, where firt 4 numbers have a meaning, while all the rest info is just for user. 1000 Name LastName and some other helpful info 1001 tom jeff smallville 1002 ming vase, 1992 ... For example, this line fotoId = ui->devices->currentItem()->text().toInt(); should give me same result in both cases.

    Read the article

  • Sorting and displaying a custom QVariant type.

    - by Kranar
    Hello, I have a custom type I'd like to use with QVariant but I don't know how to get the QVariant to display in a table or have it sort in a QSortFilterProxyModel. I register the type with Q_DECLARE_METATYPE and wrote streaming operators registered via qRegisterMetaTypeStreamOperators but for whatever reason when I use the type with a table model, it doesn't display anything and it doesn't sort. I should specify that this custom type can not be modified. It has a copy and default constructor, but I can not go in and modify the source code to get it to work with QVariant. Is there a way of non-intrusively getting the behaviour I'd like?

    Read the article

  • emit signal from thread

    - by Umesha MS
    Hi, I am writing a sample which uses thread to do some background processing. In the thread I am trying to emitting a signal. But it is not coming to slot. While connecting I checked the value of “connect()” function value , it is returning value as true. One thing to notice is in the run method I am not using “exec() “ . Please help me to solve this problem.

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >