Search Results

Search found 147 results on 6 pages for 'qwidget'.

Page 1/6 | 1 2 3 4 5 6  | Next Page >

  • Finding a 3rd party QWidget with injected code & QWidget::find(hwnd)

    - by David Menard
    Hey, I have a Qt Dll wich I inject into a third-party Application using windows detours library: if(!DetourCreateProcessWithDll( Path, NULL, NULL, NULL, TRUE, CREATE_DEFAULT_ERROR_MODE | CREATE_SUSPENDED, NULL, NULL, &si, &pi, "C:\\Program Files\\Microsoft Research\\Detours Express 2.1\\bin\\detoured.dll", "C:\\Users\\Dave\\Documents\\Visual Studio 2008\\Projects\\XOR\\Debug\\XOR.dll", NULL)) and then I set a system-wide hook to intercept window creation: HHOOK h_hook = ::SetWindowsHookEx(WH_CBT, (HOOKPROC)CBTProc, Status::getInstance()->getXORInstance(), 0); Where XOR is my programs name, and Status::getInstance() is a Singleton where I keep globals. In my CBTProc callback, I want to intercept all windows that are QWidgets: HWND hwnd= FindWindow(L"QWidget", NULL); which works well, since I get a corresponding HWND (I checked with Spy++) Then, I want to get a pointer to the QWidget, so I can use its functions: QWidget* q = QWidget::find(hwnd); but here's the problem, the returned pointer is always 0. Am I not injecting my code into the process properly? Or am I not using QWidget::find() as I should? Thanks, Dave EDIT:If i change the QWidget::find() function to an exported function of my DLL, after setting the hooks (so I can set and catch a breakpoint), QWidgetPrivate::mapper is NULL.

    Read the article

  • pyQt4: QWidget subclass not responding to new setStyleSheet() background colour

    - by Ronny
    I am having an issue with PyQt4. I want to create a new widget within a window, and I want this widget to have a custom color. When i create a subclass of the QWidget class, and instantiate it, I am not able to change its background color through the setStyleSheet() function. When I instantiate a new QWidget object, I have no problems in changing its background color. But i dont want an ordinary QWidget object.I want to create my own subclass of QWidget. When i create a subclass of a QPushButton, I am also able to change its background color using the setStyleSheet() function. There are no error messages or warnings in the console window, it just refuses to work properly without any indication as to why. So what i would like to know is why is it that i can change the background color of a widget if i simply create a QWidget object, or a subclass of QPushButton, but not when i create a subclass of QWidget. And how can i therefore change the background color of an object that is a subclass of QWidget? Is it maybe something specific to the version of python or PyQt that i am using? Is it a bug in the library? or some flaw in the way that i am writing my code? I am using python 2.6.4 and PyQt4 Below is an example of the code that leads me to trouble. There are three widgets within the window one below the other. The parent widget is set with background color of green. The top widget is set to red, the middle one, is the subclass of QWidget, which should be blue, but it appears invisible because it takes on the color of the parent window for some reason. and the bottom widget is a subclass of QPushButton and is white. import sys from PyQt4 import QtGui, QtCore ################################################################################ #--------------------------------------------------------- CUSTOM WIDGET CLASS 1 class CustomWidget(QtGui.QWidget): def __init__(self, parent): QtGui.QWidget.__init__(self, parent) # some custom properties and functions will follow ################################################################################ #--------------------------------------------------------- CUSTOM WIDGET CLASS 2 class CustomWidget2(QtGui.QPushButton): def __init__(self, parent): QtGui.QPushButton.__init__(self, parent) # some custom properties and functions will follow ################################################################################ #----------------------------------------------------------- PARENT WIDGET CLASS class Parent(QtGui.QWidget): def __init__(self, parent=None): #---------------------------------------------------------- SETUP WINDOW QtGui.QWidget.__init__(self, parent) self.resize(500, 340) self.setStyleSheet("QWidget {background-color: #00FF00}") #-------------------------------------------------- SETUP DEFAULT WIDGET wid1 = QtGui.QWidget(self) wid1.setGeometry(10, 10, 480, 100) wid1.setStyleSheet("QWidget {background-color: #FF0000 }") #------------------------------------------------- SETUP CUSTOM WIDGET 1 wid2 = CustomWidget(self) wid2.setGeometry(10, 120, 480, 100) wid2.setStyleSheet("QWidget {background-color: #0000FF }") for i in dir(wid2): print i #------------------------------------------------- SETUP CUSTOM WIDGET 2 wid3 = CustomWidget2(self) wid3.setGeometry(10, 230, 480, 100) wid3.setStyleSheet("QWidget {background-color: #FFFFFF }") ################################################################################ #-------------------------------------------------------------------------- MAIN app = QtGui.QApplication(sys.argv) win = Parent() win.show() app.exec_()

    Read the article

  • Qt - change QWidget layout

    - by Narek
    Let's consider we have a QWidget and a layout named general_layout that contains other widgets and layouts. general_layout is set as the QWidget layout (setLayout(general_layout)). Now I should to change the content of QWidget. How should I do? I have tried to delete and create a new layout for QWidget and that new layout set as a layout of the QWidget, but could not complet my intentions successfully.

    Read the article

  • Qt- how to set QWidget width

    - by Narek
    How to set QWidget width? I know setGeometry(QRect& rect) function to do that, but in that case I should use geometry() function to get former parameters of my QWidget, then I should increment the width and use setGeometry(..). Is there any ditect way to say QWidget aa; aa.setWidth(165); //something like this?

    Read the article

  • QTableWidget alignement with the borders of its parent QWidget

    - by Narek
    Let's consider we have QWidget that contains QTableWidget (only). So we want to resize the table by resizing the widget, and we dont want to have an indet between the QWidget border and cells of the table. What kind of property is making posible for QTableWidget to be aligned with the borders of it parent widget? Thanks.

    Read the article

  • Make qwidget in new window in PyQt4

    - by matt
    I'm trying to make a class that extends qwidget, that pops up a new window, I must be missing something fundamental, class NewQuery(QtGui.QWidget): def __init__(self, parent): QtGui.QMainWindow.__init__(self,parent) self.setWindowTitle('Add New Query') grid = QtGui.QGridLayout() label = QtGui.QLabel('blah') grid.addWidget(label,0,0) self.setLayout(grid) self.resize(300,200) when a new instance of this is made in main window's class, and show() called, the content is overlaid on the main window, how can I make it display in a new window?

    Read the article

  • Qwidget window disappears [migrated]

    - by user3716006
    Okay... This has been bugging me for hours. I have a qtmainwindow with a menubar. I've managed to connect an action in tje menubar to an independent Qwidget. But as soon as the Qwidget appears it disappears. I'm using the latest version of pyqt. Here's the code: Import sys from PyQt4 import QtGui, QtCore Class Main(QtGui.QtMainWindow) : def __init__(self) : QtGui.QtMainWindow.__init__(self) self.setGeometry(300,300,240,320) self.show() menubar = self. menuBar() filemenu = menubar. addMenu('&File') new = QtGui.QAction(QtGui.QIcon('new.png'), 'New', self) new.triggered.connect(self.pop) filemenu.addAction(new) def pop(self) : pop = Pop() class Pop(QtGui.QWidget) : def __init__(self) : QtGui.QWidget.__init__(self) self.setGeometry(300,300,240,320> self.setWindowTitle('Pop up') self.show()

    Read the article

  • QWidget keyPressEvent override

    - by eaigner
    Hi there, I'm trying for half an eternity now overriding QWidgets keyPressEvent function in QT but it just won't work. I've to say i am new to CPP, but I know ObjC and standard C. My problem looks like this: class QSGameBoard : public QWidget { Q_OBJECT public: QSGameBoard(QWidget *p, int w, int h, QGraphicsScene *s); signals: void keyCaught(QKeyEvent *e); protected: virtual void keyPressEvent(QKeyEvent *event); }; QSGameBoard is my QWidget subclass and i need to override the keyPressEvent and fire a SIGNAL on each event to notify some registered objects. My overridden keyPressEvent in QSGameBoard.cpp looks like this: void QSGameBoard::keyPressEvent(QKeyEvent *event) { printf("\nkey event in board: %i", event->key()); //emit keyCaught(event); } When i change QSGameBoard:: to QWidget:: it receives the events, but i cant emit the signal because the compiler complains about the scope. And if i write it like this the function doesn't get called at all. What's the problem here?

    Read the article

  • Qt: Animating the 'roll down' of a QWidget

    - by eAi
    I have a QWidget that contains various other widgets. I want to animate it appearing on the screen by gradually revealing it from the top down, increasing it's height from 0 to whatever it's natural height would be. The way I have it currently is: mAnimation = new QPropertyAnimation(this, "maximumHeight"); mAnimation->setStartValue(0); mAnimation->setEndValue(400); mAnimation->start(); This has two issues: - It crashes when the height reaches a certain height, with a "qDrawShadeRect: Invalid parameters" error. - If I change the 0 to 100, it works fine, but the widgets contained within the QWidget I'm animating have their layout changed as the widget animates, starting very squashed together and gradually spreading apart as they get more space. This looks ugly! Does anyone have any suggestions?

    Read the article

  • Launch a QWidget from a QMain window

    - by Opera
    Hello everyone ! I'm doing my first C++ - Qt4 application and I'm having some trouble "connecting" my different uis. I have a main window with several buttons and when I click on one, I want another window to open. The MyMainWindowClass inherits from QMainWindow and the other from QWidget. Here is the code I have written so far : #include <iostream #include "MyWidgetClass.hpp" #include "MyMainWindowClass.hpp" #include "ui_MyMainWindowClassUi.h" MyMainWindowClass::MyMainWindowClass(QWidget *parent) : QMainWindow(parent), m_ui(new Ui::MyMainWindowClassUi) { m_ui-setupUi(this); initConnect(); } void MyMainWindowClass::initConnect() { QObject::connect(m_ui-SomeBtn, SIGNAL(clicked()), this, SLOT(SomeBtnClicked())); // Some other QObject::connect calls return; } void MyMainWindowClass::SomeBtnClicked() { std::cout << "Some Btn has been clicked" << std::endl; this-setEnabled(false); MyWidgetClass mwc(this); mwc.show(); return; } This calls the Ctor and the Dtor from MyWidgetClass, disables the MyMainWindowClassUi, but doesn't show my other GUI. What am I missing to have the window showed when I click on the button ?

    Read the article

  • Get a QWidget to take up the entire QMainWindow

    - by Bad Man
    I have a class that inherits QMainWindow and I just want it to have a webview widget and nothing else, so here's what I tried doing for constructor: MyWindow::MyWindow(QWidget *parent) : QMainWindow(parent) { this->_webView = new QWebView(this); this->setCentralWidget(this->_webView); } This didnt work do I have to use some kind of layout to make this fill?

    Read the article

  • QScrollArea widget content promoted to QWidget

    - by ocell
    Hi folks, First of all, thanks for you time reading my question. I created my own Qt Widget (parent of QWidget) and has a QImage "inside" to manipulate images. The problem I have is the following: when I promote the content of a QScrollArea to my widget, the scroll features doesn't works; I haven't any scroll bar or I can't see any result when I use the method 'ensureVisible(..)'. Please can you tell me if I need to overload or override any method in my own widget. Regards and thanks in advance, Oscar.

    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

  • Help Qt Widgets for creating Accessories Bar on my device

    - by Surjya Narayana Padhi
    Hi Geeks, For a handheld device I want to put a vertical Bar which will contain widgets that show the battery status of device, network connectivity status, Date and Time etc. For this Bar I have chosen a GroupBox and for the widgets inside that (lets say batter status) I am planning to use QPushButton. Is it correct I am doing or there is some special widgets for this purpose? Please suggest.

    Read the article

  • Change table columns width on resizing window or splitter

    - by Narek
    Consider there is a QTablWidget and a QTextEdit. Both of them are in a horisontal QSplitte. Let the QTable widget has 2 columns. The problem is to resize the table columns' width as you do resize operation by moving the splitter with mouse. Are there any options to may colums to be resized synchornosly with the table? Thanks.

    Read the article

  • QT4 Designer - Implement Widget

    - by MOnsDaR
    I'm currently trying to get into QT4 and figure out a workflow for myself. While trying to create a widget which allows the user to connect to a hostname:port some questions appeared. The widget itself contains a LineEdit for entering the hostname, a SpinBox for entering the port and a PushButton which should emit a connect(QString hostname, unsigned int port) signal. In QTDesigner I created the necessary Form. It is saved as a .ui-File. Now the big question is how could I implement the widget? Is there a place in QTDesigner where I could add my signal to the Widget? Where could I add custom Properties? I've learned in another tutorial, which showed how to create a Widget in C++, how signals, slots, Q_PROPERTIES etc are defined and added to the widget. But there is no sourcecode in QTDesigner. Another option would be to generate sourcecode using uic. But the header says, that another generate would overwrite any changes to the sourcefiles. So how can I create a QT-widget completely with my own signals, slots and properties by using the QTDesigner for creating the UI and not having to recode everything whenever the UI is changing. Is there some kind of Roundtrip-Engineering? If thats not possible: Whats the sense of creating a Widget with QTDesigner then?

    Read the article

  • How to Redirect a Python Console output to a QTextBox

    - by krishnanunni
    Hello, I'm working on developing a GUI for the recompilation of Linux kernel. For this I need to implement 4-5 Linux commands from Python. I use Qt as GUI designer. I have successfully implemented the commands using os.system() call. But the output is obtained at the console. The real problem is the output of command is a listing that takes almost 20-25 min continuous printing. How we can transfer this console output to a text box designed in Qt. Can any one help me to implement the setSource() operation in Qt using source as the live console outputs.

    Read the article

  • Resizing qt widgets when their children are hidden

    - by laura
    I have the situation in the following image: How would I go about resizing the widget when the retry child is hidden so that it looks as in the first image? The main layout is a QVBoxLayout, the retry child is a widget with a QVBoxLayout as well. I've tried the following: update() updateGeometry() setGeometry(childrenRect()) layout()-activate() on the main widget as soon as I've set the retry widget to hidden. Do I need to intercept some event to do this?

    Read the article

  • 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

  • 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

1 2 3 4 5 6  | Next Page >