Search Results

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

Page 23/119 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • How to access widgets created within functions in later function calls in Qt

    - by Inanepenguin
    So currently I have code, in C++, that creates a few QLabels, a QLineEdit, and a QCheckBox when a selection is made from a QComboBox. However, I would like to be able to access the widgets I have created in a later function to destroy them if a new selection is made from the combo box. I am able to access the objects created from using the Designer by doing ui-Object but i am not able to do that with objects created by using my own code. Can I do that some how, because I know how to work with that. In short, I would like to be able to dynamically create/destroy QWidgets based on selections made by the user. Is there a reference I should know of to do this, or any documentation? Or am I just completely going about this the wrong way? Here is the code I presently have for creating the objects: if (eventType == QString::fromStdString("Birthday")) { QLabel *label1 = new QLabel ("Celebrant: "); QLabel *label2 = new QLabel ("Surprise: "); QLineEdit *lineEdit = new QLineEdit; QCheckBox *box = new QCheckBox; ui->gridLayout->addWidget(label1,3,0,1,1, 0); ui->gridLayout->addWidget(label2,4,0,1,1,0); ui->gridLayout->addWidget(lineEdit,3,1,1,1,0); ui->gridLayout->addWidget(box,4,1,1,2,0); }

    Read the article

  • how to add menu dynamically in Qt

    - by Solitaire
    Hi, I want to add, submenu to a menu item dynamically. How can I achive this? I tried like this, I have created an Action and submenu. Then I have added the submenu to action. But, I have connected the “triggered” signal of action. its getting crash if I click on the action.. I have also handled the “aboutToShow” signal of menu, same its also getting crash when I click on action.. Here is the sampe code. Submenu = new QMenu(this); connect(Submenu, SIGNAL( aboutToShow()), this, SLOT(move ())); QAction *test = new QAction(tr("Selection"), this); test ->setMenu(Submenu); menubar()->addAction(test); I want to get the notification, before the display of submenu..

    Read the article

  • Qt XQuery into a QStringList

    - by Stewart
    Hi, I'm trying to use QtXmlQuery to extract some data from XML. I'd like to put this into a QStringList. I try the following: QByteArray in = "this is where my xml lives"; QBuffer received; received.setData(in); received.open(QIODevice::ReadOnly); QXmlQuery query; query.bindVariable("data", &received); query.setQuery(NAMESPACE //contains definition of the t namespace "doc($data)//t:service/t:serviceID/text()"); QBuffer outb; outb.open(QIODevice::ReadWrite); QXmlSerializer s(query, &outb); query.evaluateTo(&s); qDebug() << "buffer" << outb.data(); //This works perfectly! QStringList * queryResult = new QStringList(); query.evaluateTo(queryResult); qDebug() << "string list" << *queryResult; //This gives me no output! As you can see, everything works fine when I send the output into a QBuffer via a QXmlSerializer... but I get nothing when I try to use a QStringList.

    Read the article

  • Qt: QAbstractItemModel and 'const'

    - by Eye of Hell
    Hello. I'm trying to use a QTreeView for a first time, with a QAbstractItemModel. And instantly it's a problem: QAbstractItemModel interface declares methods as 'const', assuming they will not change data. But i want a result of SQL query displayed, and returning data for a record with specified indeq REQUIRES to use QSqlQuery::seek() that is a non-const. Is it any 'official' guideline to use a QAbstractItemModel with data that MUST be changed in order to get number of items, data per item etc? Or i must hack C++ with const casts?

    Read the article

  • File write not getting updated in Qt 4.5.3

    - by user249490
    Hi, I have an XML file. My application requires manipulation into that XML file. I will be writing the values into the XML value. I also have interface to display the read contents of the file. The user might add values into that XML (through an interface). Without closing the application he may decide to display the File contents also. Now the problem is, after i write the XML contents into the file, when i view the file through the interface , the values are not getting updated. After i close the application and open it the updated values are available.I am using the following code to achieve this. For writing QXmlStreamWriter and for reading QDomDocument, QDomNodeList. After i complete the writing, I flush and close the file too. lFile.flush(); lFile.close(); After reading also i closed the file. Can someone tell me what am doing wrong??

    Read the article

  • Qt + QTextEdit content into QDomDocument

    - by kaycee
    hi, i'm having QTextEdit widget with large content in it (content is XML). i want to take the content and set it into a QDomDocument, so i take the content using document = textEdit->document(); but i dont know how to take it from here into a QDomDocument... what's the best way to do it ?

    Read the article

  • Qt releasing memory occopied by unneeded images

    - by Gerhman
    I have a QML Flickable with 3 QML image elements that cycle through 8 image files. My problem is for each new image it loads into memory it does not release the the unused image. This is causing memory usage to become double what is necessary at times. I would like to know if there is some function I can use to force it to unload all the unused images? If it makes a difference, this is mainly for Symbian.

    Read the article

  • how to convert unicode to printble string in QT stream

    - by user63898
    hi i writing stream in to file and stdout but im getting somekind of encoding like this: "\u05ea\u05e7\u05dc\u05d9\u05d8 \u05e9\u05e1\u05d9\u05de\u05dc \u05e9\u05d9\u05e0\u05d5\u05d9 \u05d1\u05e1\u05d2\u05e0\u05d5\u05df \u05dc\u05d3\u05e2\u05ea\u05d9 \u05d0\u05dd \u05d0\u05e0\u05d9 \u05d6\u05d5\u05db\u05e8 \u05e0\u05db\u05d5\u05df" how can i convert it to printable string

    Read the article

  • Qt "no matching function for call"

    - by Blin
    I have no matching function for call to 'saveLine::saveLine()' error when compiling my application. The construcor is never actually called. saveLine class definition: class saveLine { public: saveLine(QWidget *parent); private: QPushButton *selectButton, *acceptButton; QLabel *filePath; QLineEdit *allias; }; saveLine is used in another class which is defined as follows: class MWindow : public QWidget { Q_OBJECT public: MWindow(QWidget *parent=0); private: saveLine line1; }; error points to MWindow constructor implementation MWindow::MWindow(QWidget *parent):QWidget(parent) { this->setWindowTitle("Launcher"); this->resize(600,600); } What should i do? I intend to use saveLine class in a vector, to create lines at runtime.

    Read the article

  • how to set the item selection forcefully in Qt

    - by Solitaire
    Hi.. Can any one tell me how to set the item to be selected forcefully.. I tried this after adding items to list row.. QModelIndex index = mylistview->currentIndex(); mylistview ->setCurrentIndex(index); its not working.. index I am getting index (-1,-1).. can any one help me on this Thanks

    Read the article

  • I'm following Qt Tutorials and got a simple question

    - by nzer0
    If I want to create my own class MyWidget which inherits from QWidget Tutorial tells me to write constructor like this... MyWidget::MyWidget(QWidget *parent) : QWidget(parent){....} I'm wondering what is the role of : QWidget(parent) Does it mean explicit call for QWidget's constructor?

    Read the article

  • Qt - controlling drag behaviour

    - by bullettime
    Suppose I want my draggable widget to move differently than just staying under my cursor while being dragged. For instance, having the widget move only in one axis, or have the widget move double the distance between the cursor and the drag starting point. Which method should I override to define this kind of behaviour?

    Read the article

  • Qt - 2 QMainWindow glued - Size of Layout

    - by user1773603
    I have a main window that I center this way in main.cpp : int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow *qmain = new QMainWindow; Ui_MainWindow ui; ui.setupUi(qmain); QRect r = qmain->geometry(); r.moveCenter(QApplication::desktop()->availableGeometry().center()); qmain->setGeometry(r); qmain->show(); return app.exec(); } In this "qmain" main window, I can create another QMainWindow and I try to make stick (or glue I don't know how to say) the two windows. Actually, I would like the right-top corner of the first one to be located at the left-top of the second one. For this, I use the following Ui_MainWindow's member function : void Ui_MainWindow::generate_IC() { qmenu = new QMainWindow; DiskMenu = new Ui_DiskGalMenu; DiskMenu->setupUi(qmenu); setInitialDiskMenuPosition(qmenu, this); qmenu->show(); } and the setInitialDiskMenuPosition : void Ui_MainWindow::setInitialDiskMenuPosition(QMainWindow *MainWindow, Ui_MainWindow *parent) { QSize size = parent->widget->size(); QDesktopWidget* desktop = QApplication::desktop(); int width = desktop->width(); int height = desktop->height(); int mw = size.width(); int mh = size.height(); int right = (width/2) + (mw/2); int top = (height/2) - (mh/2); MainWindow->move(right, top); } But the problem is that I don't get exactly what I want since the centralwidget size "parent- widget-size()" only returns the size of the widget and not the whole "qmain" parent window. So I have a light shift because the borders of the "qmain" window are not taken in account like it is shown below : If I could have access to the size of the whole parent window... If anyone could help me

    Read the article

  • Qt request never trigger the finished() signal

    - by user63898
    i have something realy strange i have this code : m_url.setUrl("www.cnn.com"); QNetworkRequest request; request.setRawHeader("User-Agent", USER_AGENT.toUtf8()); request.setRawHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); request.setRawHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); request.setRawHeader("Accept-Language", "en-us,en;q=0.5"); request.setRawHeader("Connection", "Keep-Alive"); request.setUrl(m_url); reply = qnam.get(request); //QNetworkAccessManager qnam member of the class; connect(reply, SIGNAL(finished()), this, SLOT(httpFinished())); the httpFinished() function that is under private slots: never triggered , why ?

    Read the article

  • Qt hide QLayout (switch between two layouts)

    - by Lodhart
    I didn't find solution for my problem with two QLayouts. I need app with QHBoxLayout with possible expandind when I will add new widgets, push buttons, .... So what I have: One QDialog and two layouts. Now I know that I can't hide the layout. So I tray just : layout()->removeItem(firstlayout); layout()->addLayout(secondLayout); But when I did this, I saw all items in first layout on possition [0,0]. So next step I try: for (all items in first layout) if (widget) widget->hide(); But this is working only with QWidget and I have many different items in layouts. Simply way is use the widget, because there is possibole to use hide/show, but I need auto expanding window when I add new items.

    Read the article

  • QT List of Callbacks

    - by Talguy
    I am trying to make a real-time data collection application that has timed task. Each task can have a different or the same update period. I would like to store the task with the common update period in a list where I can iterate through it and call the function that I registered in the list. How would I go about adding callbacks to a data structure like a list or vector? Can I store slots in them?

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >