Search Results

Search found 2964 results on 119 pages for 'qt stylesheet'.

Page 31/119 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • How do I use QXmlQuery properly? (Qt XQuery/XPath)

    - by Steven Jackson
    I'm using the following code to load in an XML file (actually an NZB): QXmlQuery query; query.bindVariable("path", QVariant(path)); query.setQuery("doc($path)/nzb/file/segments/segment/string()"); if(!query.isValid()) throw QString("Invalid query."); QStringList segments; if(!query.evaluateTo(&segments)) throw QString("Unable to evaluate..."); QString string; foreach(string, segments) qDebug() << "String: " << string; With the following input, it works as expected: <?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE nzb PUBLIC "-//newzBin//DTD NZB 1.0//EN" "http://www.newzbin.com/DTD/nzb/nzb-1.0.dtd"> <nzb> <file> <groups> <group>alt.binaries.cd.image</group> </groups> <segments> <segment>[email protected]</segment> </segments> </file> </nzb> However, with the following input no results are returned. This is how the input should be formatted, with attributes: <?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE nzb PUBLIC "-//newzBin//DTD NZB 1.0//EN" "http://www.newzbin.com/DTD/nzb/nzb-1.0.dtd"> <nzb xmlns="http://www.newzbin.com/DTD/2003/nzb"> <file poster="[email protected]" date="1225385180" subject="ubuntu-8.10-desktop-i386 - ubuntu-8.10-desktop-i386.par2 (1/1)"> <groups> <group>alt.binaries.cd.image</group> </groups> <segments> <segment bytes="66196" number="1">[email protected]</segment> <segment bytes="661967" number="1">[email protected]</segment> </segments> </file> </nzb> Please can someone tell me what I'm doing wrong?

    Read the article

  • What is the easiest way to reference libraries in Qt projects?

    - by Jake Petroules
    I have two Qt4 Gui Application projects and one shared library project, all referenced under a .pro file with the "subdirs" template. So, it's like: exampleapp.pro app1.pro app2.pro sharedlib.pro Now, what I want to do is reference sharedlib from app1 and app2 so that every time I run app1.exe, I don't have to manually copy sharedlib.dll from its own folder to app1.exe's folder. I could set PATH environment variable in the projects window, but this isn't very portable. I've looked at putting the LIBS variable in the app1.pro file, but I'm not sure if that refers to statically linked libraries only - I've tried it with various syntaxes and it doesn't seem to work with shared libs.

    Read the article

  • How to replace a Widget with another using Qt ?

    - by Natim
    Hi, I have an QHBoxLayout with a QTreeWidget on the left, a separator on the middle and a widget on the right. When I click on the QTreeWidget, I want to change the widget on the right to modify the QTreeWidgetItem I tried to do this with this code : def new_rendez_vous(self): self.ui.horizontalLayout_4.removeWidget(self.ui.editionFormWidget) del self.ui.editionFormWidget self.ui.editionFormWidget = RendezVousManagerDialog(self.parent) self.ui.editionFormWidget.show() self.ui.horizontalLayout_4.addWidget(self.ui.editionFormWidget) self.connect(self.ui.editionFormWidget, QtCore.SIGNAL('saved'), self.scheduleTreeWidget.updateData) def edit(self, category, rendez_vous): self.ui.horizontalLayout_4.removeWidget(self.ui.editionFormWidget) del self.ui.editionFormWidget self.ui.editionFormWidget = RendezVousManagerDialog(self.parent, category, rendez_vous) self.ui.editionFormWidget.show() self.ui.horizontalLayout_4.addWidget(self.ui.editionFormWidget) self.connect(self.ui.editionFormWidget, QtCore.SIGNAL('saved'), self.scheduleTreeWidget.updateData) def edit_category(self, category): self.ui.horizontalLayout_4.removeWidget(self.ui.editionFormWidget) del self.ui.editionFormWidget self.ui.editionFormWidget = CategoryManagerDialog(self.parent, category) self.ui.editionFormWidget.show() self.ui.horizontalLayout_4.addWidget(self.ui.editionFormWidget) self.connect(self.ui.editionFormWidget, QtCore.SIGNAL('saved'), self.scheduleTreeWidget.updateData) But it doesn't work and all the widgets are stacked up on each other : . Do you know how I can remove the old widget and next display the new one ?

    Read the article

  • How to decode "application/x-qabstractitemmodeldatalist" in Qt for drag and drop?

    - by gct
    I've created a child class of QTreeWidget that I want to be able to drag items from another tree widget too (I want to handle the insertion myself though), as well as from a QListWidget. I've overridden the dropEvent method in my class, and it looks like the mimetype of the data I'm getting from my QTreeWidget is application/x-qabstractitemmodeldatalist, how can I decode this to get the items from the tree back out?

    Read the article

  • How to set input focus to a shown dialog in Qt?

    - by Jake Petroules
    In a button click slot, I create and exec() a dialog with a NULL parent. Inside the dialog's constructor, I have: this->activateWindow(); this->raise(); this->setFocus(); The dialog is application modal and has strong focus. However, it does NOT respond to keyboard events until I click on it. How do I make the dialog get focus without having to click it?

    Read the article

  • For Qt 4.6.x, how to auto-size text to fit in a specified width?

    - by darenchow
    Inside of my QGraphicsRectItem::paint(), I am trying to draw the name of the item within its rect(). However, for each of the different items, they can be of variable width and similarly names can be of variable length. Currently I am starting with a maximum font size, checking if it fits and decrementing it until I find a font size that fits. So far, I haven't been able to find a quick and easy way to do this. Is there a better, or more efficient way to do this? Thanks! void checkFontSize(QPainter *painter, const QString& name) { // check the font size - need a better algorithm... this could take awhile while (painter->fontMetrics().width(name) > rect().width()) { int newsize = painter->font().pointSize() - 1; painter->setFont(QFont(painter->font().family(), newsize)); } }

    Read the article

  • Qt: Dragging a widget to scroll the widget's parent QScrollArea?

    - by samsonite
    I've got a long horizontal QLabel displaying a png (the image shows a signal/time graph). Under that, I've got a QTableWidget. Both of these are in a QScrollArea because I want them to stay vertically aligned (the cells in the table correspond with the signal seen directly above them). I'm trying to add a handler to the QLabel such that the user can use the picture itself to scroll the scrollarea, rather than having to use the scrollbar. Is there a tried-and-tested way to do this? Directly setting the scrollarea's sliderPosition inside the QLabel's dragMoveEvent doesn't seem smart, because when the scrollarea scrolls it also leads to another dragMoveEvent on the (moving) QLabel.

    Read the article

  • How to automate detection of out of order tab navigation in Qt dialogs?

    - by WilliamKF
    Typically, a dialog wishes to have tab navigation proceed in an orderly fashion through a dialog that roughly corresponds to the order of reading a book. When new fields are added to a dialog by engineers on a team, the new widgets can often not be inserted in tab correct order. Can anyone think of a way to automate the detection of out of tab navigation order widgets within a dialog?

    Read the article

  • Qt -how to know whether content in child widgets has been changed?

    - by Narek
    In QMainWindow I have 2 QSplitters. In that splitters I have QTextEdit, QLineEdits, QTableWinget, Ragio buttons and so on... I want to know if somthing has been chaged after pressing File-New menu button. Is there any general method for doing this? Somwhere I have read that it is recomended to use isWindowModified() function of QMainWindow, but seems it doesn't work.

    Read the article

  • How to pass variables to slot methods in QT?

    - by Neko
    Hi. I'm making a little chat messenger program, which needs a list of chat channels the user has joined. To represent this list graphically, I have made a list of QPushButtons, which all represent a different channel. These buttons are made with the following method, and that's where my problem kicks in: void Messenger::addToActivePanels(std::string& channel) { activePanelsContents = this->findChild<QWidget *>(QString("activePanelsContents")); pushButton = new QPushButton(activePanelsContents); pushButton->setObjectName("pushButton"); pushButton->setGeometry(QRect(0, 0, 60, 60)); pushButton->setText(""); pushButton->setToolTip(QString(channel.c_str())); pushButton->setCheckable(true); pushButton->setChecked(false); connect(pushButton, SIGNAL(clicked()), this, SLOT(switchTab(channel))); } (activePanelContents is a QWidget that holds the list.) The point is that each button should call the switchTab(string& tabname) method when clicked, including the specific channel's name as variable. This implementation doesn't work though, and I haven't been able to find out how to properly do this, even after reading several pages on it on the internet. Can anybody please tell me how to do this? It'd be greatly appreciated, as always. :)

    Read the article

  • How to save a file that contains 2 QMap datas in Qt?

    - by Hanny
    I have 2 datas which type is QMap: 1.QMap novel; QString tempChapter; QString tempStory; 2.QMap combo; int tempInd; QString tempChap; my question is: How can I save these 2 Datas into a single file?? And if it's successfully saved, how can I load these 2 datas? Please insert the code too because I'm a beginner C++ programmer and dont know much about OOP,, please answer this ASAP! Thank you very much! :)

    Read the article

  • [Qt] How to make another window pop up that extends QWidget as opposed to QDialog?

    - by Graphics Noob
    So far I've only had my main window pop up other windows that were QDialogs and I'm not getting it to work with a QWidget. The other window I want to display was designed with the Form Editor, then wrapped in a class called ResultViewer which extends QWidget (as opposed to QDialog). What I want is to have the ResultViewer show its ui in a seperate window. Now when I try to display it the ResultViewer ui just pops up in the main window on top of the mainwindow ui. The code I'm using to display it is this (in my mainwindow.cpp file) ResultViewer * rv = new ResultView(this); rv->show(); The constructor for the ResultViewer looks like this ResultViewer::ResultViewer(QWidget * parent) : QWidget(parent), ui(new Ui::ResultViewer) { ui->setupUi(this); } I've looked through the QWidget documentation a bit but the only thing I can find that may be related is the QWidget::window() function, but the explanation isn't very clear, it just gives an example of changing the title of a window.

    Read the article

  • Why does this PNG file look so poorly when embedded as a resource in a Qt project?

    - by George Edison
    Here is the PNG file and what it looks like in a QWebView when accessed via http://sstatic.net/so/img/logo.png: When accessed via HTTP: <img src="http://sstatic.net/so/img/logo.png" width='250' height='61' /> When accessed via a resource: <img src="qrc:/images/logo.png" width='250' height='61' /> As you can see, the only modification was the src attribute of the image tag... why the drop in quality? Edit: The file is being shrunk via width: and height: in the style attribute, if that makes a difference. I updated the code.

    Read the article

  • Qt: How to force a hidden widget to calculate its layout?

    - by Chris
    What I am trying to do is render a qwidget onto a different window (manually using a QPainter) I have a QWidget (w) with a layout and a bunch of child controls. w is hidden. Until w is shown, there is no layout calculations happening, which is expected. When I call w->render(painter, w->mapToGlobal(QPoint(0,0)), I get a bunch of controls all overlapping each other. w->layout()->activate();w->layout()->update() doesn't seem to do anything. Is there a way to force the layout to happen without showing w?

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >