Search Results

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

Page 52/119 | < Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >

  • Events with QGraphicsItemGroup

    - by onurozcelik
    In my application I want to use QGraphicsItemGroup for grouping items into one item. I played with it a little and not sure using it because when I want to catch events, events are merged together but I want to handle specific event with specific child. How can I achieve this?

    Read the article

  • QAbstractTableModel as a model for one QTableView and few QListViews

    - by ??????
    community. Briefly. I wrote usual model over QAbstractTableModel and using it in usual way for QTableView. But I think I need to use some columns of this model for the few QListViews in QWizard to fill main table in the right way (for user). For example: use the column2 as the QListView's model on the page1 of the wizard; column3 for page2 for its QListView etc. Please, help me to understand just two things: Am I on the right way? If yes then how can I make it simply and explicitly?

    Read the article

  • How to know coordinates in a real image from a scaled image.

    - by ocell
    Hi folks, First of all thanks for your time reading my question :-) I have an original image (w': 2124, h': 3204) and the same image scaled (w: 512, h: 768). The ratio for width is 4.14 (rw) and the ratio for height is 4.17 (rh). I'm trying to know the coordinates (x', y') in the original image when I receive the coordinates in the scaled image (x, y). I'm using the formula: x' = x * rw and y' = y * rh. But when I'm painting a line, or a rectangle always appears a shift that is incremented when x or y is higher. Please anybody knows how to transform coordinates without loosing of accuracy. Thanks in advance! Oscar.

    Read the article

  • subclassing QList and operator+ overloading

    - by Milen
    I would like to be able to add two QList objects. For example: QList<int> b; b.append(10); b.append(20); b.append(30); QList<int> c; c.append(1); c.append(2); c.append(3); QList<int> d; d = b + c; For this reason, I decided to subclass the QList and to overload the operator+. Here is my code: class List : public QList<int> { public: List() : QList<int>() {} // Add QList + QList friend List operator+(const List& a1, const List& a2); }; List operator+(const List& a1, const List& a2) { List myList; myList.append(a1[0] + a2[0]); myList.append(a1[1] + a2[1]); myList.append(a1[2] + a2[2]); return myList; } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); List b; b.append(10); b.append(20); b.append(30); List c; c.append(1); c.append(2); c.append(3); List d; d = b + c; List::iterator i; for(i = d.begin(); i != d.end(); ++i) qDebug() << *i; return a.exec(); } , the result is correct but I am not sure whether this is a good approach. I would like to ask whether there is better solution?

    Read the article

  • add the same qtreewidgetitems into the second column

    - by srinu
    hello i am using the following program to display the qtreewidget. main.cpp include include "qdomsimple.h" include include "qdomsimple.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); QStringList filelist; filelist.push_back("C:\department1.xml"); filelist.push_back("C:\department2.xml"); filelist.push_back("C:\department3.xml"); QDOMSimple w(filelist); w.resize(260,200); w.show(); return a.exec(); } qdomsimple.cpp include "qdomsimple.h" include include QDOMSimple::QDOMSimple(QStringList strlst,QWidget *parent) : QWidget(parent) { k=0; // DOM document QDomDocument doc("title"); QStringList headerlabels; headerlabels.push_back("Chemistry"); headerlabels.push_back("Mechanical"); headerlabels.push_back("IT"); m_tree = new QTreeWidget( this ); m_tree->setColumnCount(3); m_tree->setHeaderLabels(headerlabels); QStringList::iterator it; for(it=strlst.begin();it<strlst.end();it++) { QFile file(*it); if ( file.open( QIODevice::ReadOnly | QIODevice::Text )) { // The tree view to be filled with xml data // (m_tree is a class member variable) // Creating the DOM tree doc.setContent( &file ); file.close(); // Root of the document QDomElement root = doc.documentElement(); // Taking the first child node of the root QDomNode child = root.firstChild(); // Setting the root as the header of the tree //QTreeWidgetItem* header = new QTreeWidgetItem; //header->setText(k,root.nodeName()); //m_tree->setHeaderItem(header); // Parse until the end of document while (!child.isNull()) { //Convert a DOM node to DOM element QDomElement element = child.toElement(); //Parse only if the node is a really an element if (!element.isNull()) { //Parse the element recursively parseElement( element,0); //Go to the next sibling child = child.nextSiblingElement(); } } //m_tree->setGeometry( QApplication::desktop()->availableGeometry() ); //setGeometry( QApplication::desktop()->availableGeometry() ); } k++; } } void QDOMSimple::parseElement( QDomElement& aElement, QTreeWidgetItem *aParentItem ) { // A map of all attributes of an element QDomNamedNodeMap attrMap = aElement.attributes(); // List all attributes QStringList attrList; for ( int i = 0; i < attrMap.count(); i++ ) { // Attribute name //QString attr = attrMap.item( i ).nodeName(); //attr.append( "-" ); /* Attribute value QString attr; attr.append( attrMap.item( i ).nodeValue() );*/ //attrList.append( attr ); attrList.append(attrMap.item( i).nodeValue()); } QTreeWidgetItem* item; // Create a new view item for elements having child nodes if (aParentItem) { item = new QTreeWidgetItem(aParentItem); } // Create a new view item for elements without child nodes else { item = new QTreeWidgetItem( m_tree ); } //Set tag name and the text QString tagNText; tagNText.append( aElement.tagName() ); //tagNText.append( "------" ); //tagNText.append( aElement.text() ); item->setText(0, tagNText ); // Append attributes to the element node of the tree for ( int i = 0; i < attrList.count(); i++ ) { QTreeWidgetItem* attrItem = new QTreeWidgetItem( item ); attrItem->setText(0, attrList[i] ); } // Repeat the process recursively for child elements QDomElement child = aElement.firstChildElement(); while (!child.isNull()) { parseElement( child, item ); child = child.nextSiblingElement(); } } QDOMSimple::~QDOMSimple() { } for this i got the qtreewidget like this +file1 +file2 +file3 but actual wanted output is +file1 +file2 +file3 i don't know how to do it.Thanks in advance

    Read the article

  • How to delete a QProcess instance correctly?

    - by Kopfschmerzen
    Hi everyone! I have a class looking like this: class FakeRunner : public QObject { Q_OBJECT private: QProcess* proc; public: FakeRunner(); int run() { if (proc) return -1; proc = new QProcess(); QStringList args; QString programName = "fake.exe"; connect(comp, SIGNAL(started()), this, SLOT(procStarted())); connect(comp, SIGNAL(error(QProcess::ProcessError)), this, SLOT(procError(QProcess::ProcessError))); connect(comp, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(procFinished(int, QProcess::ExitStatus))); proc->start(programName, args); return 0; }; private slots: void procStarted() {}; void procFinished(int, QProcess::ExitStatus) {}; void procError(QProcess::ProcessError); } Since "fake.exe" does not exist on my system, proc emits the error() signal. If I handle it like following, my program crashes: void FakeRunner::procError(QProcess::ProcessError rc) { delete proc; proc = 0; } It works well, though, if I don't delete the pointer. So, the question is how (and when) should I delete the pointer to QProcess? I believe I have to delete it to avoid a memory leak. FakeRunner::run() can be invoked many times, so the leak, if there is one, will grow. Thanks!

    Read the article

  • Execute a PyQt app from an acpi event in linux

    - by alfredozn
    Hi, I want to use a PyQt application to display an image when some acpi event is triggered under linux. I already setting up the configuration for the event and the python scrip is executed when the event is triggered, but when program reach the creation of the QApplication app = QApplication(sys.argv) it stops without error. I tried setting up the same DISPLAY and PATH environment variables as my current user but it doesn't work. This is my event file: event=sony/hotkey SNC 00000001 00000011 action=/etc/acpi/vaio-tools/brightness/sonybright.sh up 2>&1>/tmp/vaio-tools_brightness.log I tried to find some error in the /tmp/vaio-tools_brightness.log but it doesn't log anything after it reach the QApp creation in code. any hints??

    Read the article

  • Can I un-check a group of RadioBottoms inside a group box?

    - by Claire Huang
    radio bottoms inside a group Box will be treated as a group of bottoms. They are mutual exclusive. How can I clean up their check states?? I have several radio bottoms, one of them are checked. How can I "clean" (uncheck) all radio bottoms?? "setChecked" doesn't work within a group, I tried to do following things but failed. My code is as following, radioButtom is inside a groupBox, and I want to unchecked it. The first setChecked does works, but the second one doesn't, the radioBottom doesn't been unchecked MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { QRadioButton *radioButton; ui->setupUi(this); radioButton->setChecked(true); radioButton->setChecked(false); } Where is the problem in my code?

    Read the article

  • Why do I get two clicked or released signals when using a custom slot for a QPushButton ?

    - by Chris
    here's the main code at first I thought is was the message box but setting a label instead has the same effect. #include <time.h> #include "ui_mainwindow.h" #include <QMessageBox> class MainWindow : public QWidget, private Ui::MainWindow { Q_OBJECT public: MainWindow(QWidget *parent = 0); void makeSum(void); private: int r1; int r2; private slots: void on_pushButton_released(void); }; MainWindow::MainWindow(QWidget *parent) : QWidget(parent) { setupUi(this); } void MainWindow::on_pushButton_released(void) { bool ok; int a = lineEdit->text().toInt(&ok, 10); if (ok) { if (r1+r2==a) { QMessageBox::information( this, "Sums","Correct!" ); } else { QMessageBox::information( this, "Sums","Wrong!" ); } } else { QMessageBox::information( this, "Sums","You need to enter a number" ); } makeSum(); } void MainWindow::makeSum(void) { r1 = rand() % 10 + 1; r2 = rand() % 10 + 1; label->setText(QString::number(r1)); label_3->setText(QString::number(r2)); } int main(int argc, char *argv[]) { srand ( time(NULL) ); QApplication app(argc, argv); MainWindow mw; mw.makeSum(); mw.show(); return app.exec(); } #include "main.moc"

    Read the article

  • QScrollBar Snap to value

    - by j3frea
    Hi all, I'm wanting to implement a scroll bar that snaps to particular values (like windows can snap to the edge of a screen). The idea is that as I drag the scrollbar down it snaps the bar to values as it approaches them. My scenario is displaying 3 chapters of text. I would like to be able to snap to the beginning or end of a chapter. Of course, to go to the start of the first chapter the scrollbar one can just scroll to the top and likewise with the end of the third chapter. So I'd like to draw two lines on the scrollbar to represent the start of the second and third chapters and then have the top and bottom of the scrollbar snap to those lines. So I'm really actually wanting to use this within a QTextBrowser but I can control a QTextBrowser with a "QSnapScrollBar" I just don't really know where to start. Any help would be greatly appreciated.

    Read the article

  • How can I create a properly sizing QWebView?

    - by chacham15
    I want to make a QWebView appear expanding to the width and height so that ideally it will have no scroll bars. Some websites may have fixed widths that wont allow this, but I am not concerned with those. In any case, I cannot do as I wish because QWebView implements sizeHint as follows: QSize QWebView::sizeHint() const { return QSize(800, 600); // ####... } This is incorrect on a number of levels. 1. It doesnt at all take into account the size of the actual web page. 2. It doesnt take into account that the height and width are related to each other. (To prove #2 think about text in web pages that wraps to the next line.) As a simple fix I tried to do (where QResizingWebView extends QWebView): QSize QResizingWebView::sizeHint() const{ return this-page()-mainFrame()-contentsSize(); } While this is closer to the result, it also has 2 flaws. 1. It doesnt take into account the relation between the displayed width/height. 2. this->page()->mainFrame()->contentsSize() is inaccurate from what I can tell from my preliminary testing (it has returned heights larger than it should under many cases, although this may be related to #1). Does anyone have any tips to fix this?

    Read the article

  • optimizing widget painting.

    - by yan bellavance
    I am painting a widget and I want to optimize the process. Basically i will be sliding the image in the x direction and I only want to fill the newly exposed area. Is there a way to translate the pixels of a widget without calling update or using paintevent? I know of pixmaps and such but I am wondering If I can for example draw a pixmap once and then translate what I have drawn without having to paint anything else or draw pixmaps anymore.

    Read the article

  • Why is my slot not being called?

    - by Jen
    I have this class: class CustomEdit : public QTextEdit { Q_GADGET public: CustomEdit(QWidget* parent); public slots: void onTextChanged (); }; CustomEdit::CustomEdit(QWidget* parent) : QTextEdit(parent) { connect( this, SIGNAL(textChanged()), this, SLOT(onTextChanged())); } void CustomEdit::onTextChanged () { // ... do stuff } The onTextChanged method is never called when I type text into the edit control. What am I missing?

    Read the article

  • Drawing widgets (such as buttons) over QGraphicsView

    - by Aditya Bhatt
    How do I draw interactive widgets such as QButtons and Line Edits over a QGraphicsView? For ex, I have selected a region over an image in an image editing app which displays an image with QGraphicsView, and I want to annotate this region with a name. So I want to have a Line edit and two buttons (Cross and Tick) below this rectangular selection. How do I draw these? Sample code would be cool!

    Read the article

  • Date check for counting 30 days

    - by sijith
    Hi, I want to count the days passed with respect to a given date. I have a predefined date with me and i want to check the days passed, once the day pass 30 days with respect to the given time i want to get a message. example given date is25/03/2010 and when my system date reaches 25/04/2010 i have to get a message. How can i implement it. please give some help

    Read the article

< Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >