Search Results

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

Page 6/77 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Compile Qt Project To Run On A Linux System

    - by ForgiveMeI'mAN00b
    I have a Qt project. It uses the cross platform libraries SDL, OpenGL and FLTK. I want to be able to compile the project so that it can run on a Linux computer. I'm looking at a bunch of articles I have seen so far two ways to do this. Use a cross compiler, which seems to me a rather complicated thing to setup and compile with, or, the other options, is to compile the project simply on a Linux computer, simply the Linux version of Qt creator/SDK. My question is, If I have a Qt project that uses only cross platform libraries, then is creating a Windows version easy as compiling it in Qt/Windows, and creating the Linux version as easy as doing it in Qt/Linux? PS. Please don't ask/complain about why I didn't just try to see if it works myself, I don't have any Linux OS's installed on my computer right now, and I don't want to risk going into the trouble of installing a whole new OS just to have it not work in the end.

    Read the article

  • Qt: Force QWebView to click on a web element, even one not visible on the window

    - by Pirate for Profit
    So let's say I'm trying to click a link in the QWebView, here is what I have: // extending QWebView void MyWebView::click(const QString &selectorQuery) { QWebElement el = this->page()->mainFrame()->findFirstElement(selectorQuery); if (!el) return; el.setFocus(); QMouseEvent pressEvent(QMouseEvent::MouseButtonPress, el.geometry().center(), Qt::MouseButton::LeftButton, Qt::LeftButton, Qt::NoModifier); QCoreApplication::sendEvent(this, &pressEvent); QMouseEvent releaseEvent(QMouseEvent::MouseButtonRelease, el.geometry().center(), Qt::MouseButton::LeftButton, Qt::LeftButton, Qt::NoModifier); QCoreApplication::sendEvent(this, &releaseEvent); } And you call it as so: myWebView->click("a[href]"); // will click first link on page myWebView->click("input[type=submit]"); // submits a form THE ONLY PROBLEM IS: if the element is not visible in the window, it is impossible to click. What I mean is if you have to scroll down to see it, you can't click it. I imagine this has to do with the geometry, since the element doesn't show up on the screen it can't do the math to click it right. Any ideas to get around this? Maybe some way to make the window behave like a billion x billion pixels but still look 200x200?

    Read the article

  • Qt/PyQt dialog with toggable fullscreen mode - problem on Windows

    - by Guard
    I have a dialog created in PyQt. It's purpose and functionality don't matter. The init is: class MyDialog(QWidget, ui_module.Ui_Dialog): def __init__(self, parent=None): super(MyDialog, self).__init__(parent) self.setupUi(self) self.installEventFilter(self) self.setWindowFlags(Qt.Dialog | Qt.WindowTitleHint) self.showMaximized() Then I have event filtering method: def eventFilter(self, obj, event): if event.type() == QEvent.KeyPress: key = event.key() if key == Qt.Key_F11: if self.isFullScreen(): self.setWindowFlags(self._flags) if self._state == 'm': self.showMaximized() else: self.showNormal() self.setGeometry(self._geometry) else: self._state = 'm' if self.isMaximized() else 'n' self._flags = self.windowFlags() self._geometry = self.geometry() self.setWindowFlags(Qt.Tool | Qt.FramelessWindowHint) self.showFullScreen() return True elif key == Qt.Key_Escape: self.close() return QWidget.eventFilter(self, obj, event) As can be seen, Esc is used for dialog hiding, and F11 is used for toggling full-screen. In addition, if the user changed the dialog mode from the initial maximized to normal and possibly moved the dialog, it's state and position are restored after exiting the full-screen. Finally, the dialog is created on the MainWindow action triggered: d = MyDialog(self) d.show() It works fine on Linux (Ubuntu Lucid), but quite strange on Windows 7: if I go to the full-screen from the maximized mode, I can't exit full-screen (on F11 dialog disappears and appears in full-screen mode again. If I change the dialog's mode to Normal (by double-clicking its title), then go to full-screen and then return back, the dialog is shown in the normal mode, in the correct position, but without the title line. Most probably the reason for both cases is the same - the setWindowFlags doesn't work. But why? Is it also possible that it is the bug in the recent PyQt version? On Ubuntu I have 4.6.x from apt, and on Windows - the latest installer from the riverbank site.

    Read the article

  • Qt/PyQt dialog with togglable fullscreen mode - problem on Windows

    - by Guard
    I have a dialog created in PyQt. It's purpose and functionality don't matter. The init is: class MyDialog(QWidget, ui_module.Ui_Dialog): def __init__(self, parent=None): super(MyDialog, self).__init__(parent) self.setupUi(self) self.installEventFilter(self) self.setWindowFlags(Qt.Dialog | Qt.WindowTitleHint) self.showMaximized() Then I have event filtering method: def eventFilter(self, obj, event): if event.type() == QEvent.KeyPress: key = event.key() if key == Qt.Key_F11: if self.isFullScreen(): self.setWindowFlags(self._flags) if self._state == 'm': self.showMaximized() else: self.showNormal() self.setGeometry(self._geometry) else: self._state = 'm' if self.isMaximized() else 'n' self._flags = self.windowFlags() self._geometry = self.geometry() self.setWindowFlags(Qt.Tool | Qt.FramelessWindowHint) self.showFullScreen() return True elif key == Qt.Key_Escape: self.close() return QWidget.eventFilter(self, obj, event) As can be seen, Esc is used for dialog hiding, and F11 is used for toggling full-screen. In addition, if the user changed the dialog mode from the initial maximized to normal and possibly moved the dialog, it's state and position are restored after exiting the full-screen. Finally, the dialog is created on the MainWindow action triggered: d = MyDialog(self) d.show() It works fine on Linux (Ubuntu Lucid), but quite strange on Windows 7: if I go to the full-screen from the maximized mode, I can't exit full-screen (on F11 dialog disappears and appears in full-screen mode again). If I change the dialog's mode to Normal (by double-clicking its title), then go to full-screen and then return back, the dialog is shown in the normal mode, in the correct position, but without the title line. Most probably the reason for both cases is the same - the setWindowFlags doesn't work. But why? Is it also possible that it is the bug in the recent PyQt version? On Ubuntu I have 4.6.x from apt, and on Windows - the latest installer from the riverbank site.

    Read the article

  • how does Cocoa compare to Microsoft, Qt?

    - by Paperflyer
    I have done a few months of development with Qt (built GUI programatically only) and am now starting to work with Cocoa. I have to say, I love Cocoa. A lot of the things that seemed hard in Qt are easy with Cocoa. Obj-C seems to be far less complex than C++. This is probably just me, so: Ho do you feel about this? How does Cocoa compare to WPF (is that the right framework?) to Qt? How does Obj-C compare to C# to C++? How does XCode/Interface Builder compare to Visual Studio to Qt Creator? How do the Documentations compare? For example, I find Cocoa's Outlets/Actions far more useful than Qt's Signals and Slots because they actually seem to cover most GUI interactions while I had to work around Signals/Slots half the time. (Did I just use them wrong?) Also, the standard templates of XCode give me copy/paste, undo/redo, save/open and a lot of other stuff practically for free while these were rather complex tasks in Qt. Please only answer if you have actual knowledge of at least two of these development environments/frameworks/languages.

    Read the article

  • Using custom Qt subclasses in Python

    - by kwatford
    First off: I'm new to both Qt and SWIG. Currently reading documentation for both of these, but this is a time consuming task, so I'm looking for some spoilers. It's good to know up-front whether something just won't work. I'm attempting to formulate a modular architecture for some in-house software. The core components are in C++ and exposed via SWIG to Python for experimentation and rapid prototyping of new components. Qt seems like it has some classes I could use to avoid re-inventing the wheel too much here, but I'm concerned about how some of the bits will fit together. Specifically, if I create some C++ classes, I'll need to expose them via SWIG. Some of these classes likely subclass Qt classes or otherwise have Qt stuff exposed in their public interfaces. This seems like it could raise some complications. There are already two interfaces for Qt in Python, PyQt and PySide. Will probably use PySide for licensing reasons. About how painful should I expect it to be to get a SWIG-wrapped custom subclass of a Qt class to play nice with either of these? What complications should I know about upfront?

    Read the article

  • CF - How to get mouse position when ContextMenu pops up ??

    - by no9
    I have a problem i cannot solve. In my view (that shows a map) i created a contextMenu. When context menu is invoked i need to get the position where the user has clicked on the map. Here is my problem: In the view i already have onMouseDown event that gets me the coordinates where the user clicked. private void MapView_MouseDown(object sender, MouseEventArgs e) { this.lastMouseDownX = e.X; this.lastMouseDownY = e.Y; } When the contextMenu is invoked i need the same data, but the problem is that contextMenu only has EventArgs that dont keep the data i need. Furthermore ... contextMenu is invoked when user presses and holds mouse for a second and when its invoked the code does not enter onMouseDown event ! It just goes into popup event on my context menu.... I tried putting this in my popup event, but the coordinates are not ok. Y coordinate is way off the chart. private void servicesContextMenu_Popup(object sender, EventArgs e) { this.lastMouseUpX = Control.MousePosition.X; this.lastMouseUpX = Control.MousePosition.Y; } I also tried this, but with no success ... the problem remains ... when contextMenu is invoked the code does not fire onMouseDown event. http://www.mofeel.net/58-microsoft-public-dotnet-framework-compactframework/19285.aspx Help?

    Read the article

  • Sortie de Qt 4.7.2, une version de maintenance du framework et du nouvelle EDI de Nokia Qt Creator 2.1

    Sortie de Qt 4.7.2 Avec la nouvelle version de l'EDI de Nokia Qt Creator 2.1 Mise à jour du 01/03/2011, par dourouc05 Qt 4.7.2 est sorti ce jour. Ce n'est qu'une version de maintenance, avec son lot de corrections de bogues, grâce au retour utilisateur et aux contributions, depuis la sortie de la version 4.7.1, en novembre dernier. Point plus important, il marque la sortie officielle de Qt Quick, LA nouvelle fonctionnalité clé de Qt, permettant de créer très simplement des applications légères et des interfaces utilisateur. Pour mener à bien sa mission, il se base sur QML, un langage de déclaration d'interfaces, sur le module Qt Declarative et d...

    Read the article

  • Qt 4.8.5 est disponible, cette version de maintenance sera disponible par les mêmes outils de Qt 5.1 à sa sortie

    Sortie de Qt 4.8.1 : de nombreuses corrections de bugsMise à jour du 29/03/2012 par gbdiversQuelques mois après la sortie de Qt 4.8, voici la première mise à jour avec la sortie de Qt 4.8.1. Cette version apporte principalement des corrections de bugs et plus de 200 améliorations fonctionnelles. Digia, responsable du support commercial de Qt, a fait un travail majeur dans la correction des bugs en proposant un grand nombre de corrections. La version 1.2.1 du Qt SDK devrait être mis à jour également dans les semaines prochaines pour intégrer cette nouvelle version du framework.Vous pouvez télécharger Qt 4.8.1 sur la

    Read the article

  • How can I change the UI language of QT Creator 1.3.1?

    - by simon
    I just downloaded and installed QT Creator 1.3.1 on my english Windows 7 system from the english download site at http://qt.nokia.com/downloads Apparently, however, the UI of QT Creator is in German language, although the help files are in English. From the FAQ at http://www.qt.gitorious.org/qt-creator/pages/FrequentlyAskedQuestions I found the answer Qt Creator uses the language setting of the system it runs on. On Linux systems you can also override that language by setting the LANG environment variable prior to starting Qt Creator, e.g. on the command line LANG=de ./qtcreator will run Qt Creator with german interface. This, however, is apparently not correct, as I have an English Windows, and as system locale I have "English (United Kingdom)" set. Possibly QT Creator interprets mistakenly the Windows settings for "current location", which I have set to "Germany" to mean that German would also be my language. However, changing that value had apparently no effect (maybe it should have been done before installing QT Creator). Is there any way to change the UI language of QT creator to english after installing it, preferrably without adjusting global system settings?

    Read the article

  • Conway's Game of Life - C++ and Qt

    - by Jeff Bridge
    I've done all of the layouts and have most of the code written even. But, I'm stuck in two places. 1) I'm not quite sure how to set up the timer. Am I using it correctly in the gridwindow class? And, am I used the timer functions/signals/slots correctly with the other gridwindow functions. 2) In GridWindow's timerFired() function, I'm having trouble checking/creating the vector-vectors. I wrote out in the comments in that function exactly what I am trying to do. Any help would be much appreciated. main.cpp // Main file for running the grid window application. #include <QApplication> #include "gridwindow.h" //#include "timerwindow.h" #include <stdexcept> #include <string> #include <fstream> #include <sstream> #include <iostream> void Welcome(); // Welcome Function - Prints upon running program; outputs program name, student name/id, class section. void Rules(); // Rules Function: Prints the rules for Conway's Game of Life. using namespace std; // A simple main method to create the window class and then pop it up on the screen. int main(int argc, char *argv[]) { Welcome(); // Calls Welcome function to print student/assignment info. Rules(); // Prints Conway's Game Rules. QApplication app(argc, argv); // Creates the overall windowed application. int rows = 25, cols = 35; //The number of rows & columns in the game grid. GridWindow widget(NULL,rows,cols); // Creates the actual window (for the grid). widget.show(); // Shows the window on the screen. return app.exec(); // Goes into visual loop; starts executing GUI. } // Welcome Function: Prints my name/id, my class number, the assignment, and the program name. void Welcome() { cout << endl; cout << "-------------------------------------------------------------------------------------------------" << endl; cout << "Name/ID - Gabe Audick #7681539807" << endl; cout << "Class/Assignment - CSCI-102 Disccusion 29915: Homework Assignment #4" << endl; cout << "-------------------------------------------------------------------------------------------------" << endl << endl; } // Rules Function: Prints the rules for Conway's Game of Life. void Rules() { cout << "Welcome to Conway's Game of Life." << endl; cout << "Game Rules:" << endl; cout << "\t 1) Any living cell with fewer than two living neighbours dies, as if caused by underpopulation." << endl; cout << "\t 2) Any live cell with more than three live neighbours dies, as if by overcrowding." << endl; cout << "\t 3) Any live cell with two or three live neighbours lives on to the next generation." << endl; cout << "\t 4) Any dead cell with exactly three live neighbours becomes a live cell." << endl << endl; cout << "Enjoy." << endl << endl; } gridcell.h // A header file for a class representing a single cell in a grid of cells. #ifndef GRIDCELL_H_ #define GRIDCELL_H_ #include <QPalette> #include <QColor> #include <QPushButton> #include <Qt> #include <QWidget> #include <QFrame> #include <QHBoxLayout> #include <iostream> // An enum representing the two different states a cell can have. enum CellType { DEAD, // DEAD = Dead Cell. --> Color = White. LIVE // LIVE = Living Cell. ---> Color = White. }; /* Class: GridCell. A class representing a single cell in a grid. Each cell is implemented as a QT QFrame that contains a single QPushButton. The button is sized so that it takes up the entire frame. Each cell also keeps track of what type of cell it is based on the CellType enum. */ class GridCell : public QFrame { Q_OBJECT // Macro allowing us to have signals & slots on this object. private: QPushButton* button; // The button inside the cell that gives its clickability. CellType type; // The type of cell (DEAD or LIVE.) public slots: void handleClick(); // Callback for handling a click on the current cell. void setType(CellType type); // Cell type mutator. Calls the "redrawCell" function. signals: void typeChanged(CellType type); // Signal to notify listeners when the cell type has changed. public: GridCell(QWidget *parent = NULL); // Constructor for creating a cell. Takes parent widget or default parent to NULL. virtual ~GridCell(); // Destructor. void redrawCell(); // Redraws cell: Sets new type/color. CellType getType() const; //Simple getter for the cell type. private: Qt::GlobalColor getColorForCellType(); // Helper method. Returns color that cell should be based from its value. }; #endif gridcell.cpp #include <iostream> #include "gridcell.h" #include "utility.h" using namespace std; // Constructor: Creates a grid cell. GridCell::GridCell(QWidget *parent) : QFrame(parent) { this->type = DEAD; // Default: Cell is DEAD (white). setFrameStyle(QFrame::Box); // Set the frame style. This is what gives each box its black border. this->button = new QPushButton(this); //Creates button that fills entirety of each grid cell. this->button->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); // Expands button to fill space. this->button->setMinimumSize(19,19); //width,height // Min height and width of button. QHBoxLayout *layout = new QHBoxLayout(); //Creates a simple layout to hold our button and add the button to it. layout->addWidget(this->button); setLayout(layout); layout->setStretchFactor(this->button,1); // Lets the buttons expand all the way to the edges of the current frame with no space leftover layout->setContentsMargins(0,0,0,0); layout->setSpacing(0); connect(this->button,SIGNAL(clicked()),this,SLOT(handleClick())); // Connects clicked signal with handleClick slot. redrawCell(); // Calls function to redraw (set new type for) the cell. } // Basic destructor. GridCell::~GridCell() { delete this->button; } // Accessor for the cell type. CellType GridCell::getType() const { return(this->type); } // Mutator for the cell type. Also has the side effect of causing the cell to be redrawn on the GUI. void GridCell::setType(CellType type) { this->type = type; redrawCell(); } // Handler slot for button clicks. This method is called whenever the user clicks on this cell in the grid. void GridCell::handleClick() { // When clicked on... if(this->type == DEAD) // If type is DEAD (white), change to LIVE (black). type = LIVE; else type = DEAD; // If type is LIVE (black), change to DEAD (white). setType(type); // Sets new type (color). setType Calls redrawCell() to recolor. } // Method to check cell type and return the color of that type. Qt::GlobalColor GridCell::getColorForCellType() { switch(this->type) { default: case DEAD: return Qt::white; case LIVE: return Qt::black; } } // Helper method. Forces current cell to be redrawn on the GUI. Called whenever the setType method is invoked. void GridCell::redrawCell() { Qt::GlobalColor gc = getColorForCellType(); //Find out what color this cell should be. this->button->setPalette(QPalette(gc,gc)); //Force the button in the cell to be the proper color. this->button->setAutoFillBackground(true); this->button->setFlat(true); //Force QT to NOT draw the borders on the button } gridwindow.h // A header file for a QT window that holds a grid of cells. #ifndef GRIDWINDOW_H_ #define GRIDWINDOW_H_ #include <vector> #include <QWidget> #include <QTimer> #include <QGridLayout> #include <QLabel> #include <QApplication> #include "gridcell.h" /* class GridWindow: This is the class representing the whole window that comes up when this program runs. It contains a header section with a title, a middle section of MxN cells and a bottom section with buttons. */ class GridWindow : public QWidget { Q_OBJECT // Macro to allow this object to have signals & slots. private: std::vector<std::vector<GridCell*> > cells; // A 2D vector containing pointers to all the cells in the grid. QLabel *title; // A pointer to the Title text on the window. QTimer *timer; // Creates timer object. public slots: void handleClear(); // Handler function for clicking the Clear button. void handleStart(); // Handler function for clicking the Start button. void handlePause(); // Handler function for clicking the Pause button. void timerFired(); // Method called whenever timer fires. public: GridWindow(QWidget *parent = NULL,int rows=3,int cols=3); // Constructor. virtual ~GridWindow(); // Destructor. std::vector<std::vector<GridCell*> >& getCells(); // Accessor for the array of grid cells. private: QHBoxLayout* setupHeader(); // Helper function to construct the GUI header. QGridLayout* setupGrid(int rows,int cols); // Helper function to constructor the GUI's grid. QHBoxLayout* setupButtonRow(); // Helper function to setup the row of buttons at the bottom. }; #endif gridwindow.cpp #include <iostream> #include "gridwindow.h" using namespace std; // Constructor for window. It constructs the three portions of the GUI and lays them out vertically. GridWindow::GridWindow(QWidget *parent,int rows,int cols) : QWidget(parent) { QHBoxLayout *header = setupHeader(); // Setup the title at the top. QGridLayout *grid = setupGrid(rows,cols); // Setup the grid of colored cells in the middle. QHBoxLayout *buttonRow = setupButtonRow(); // Setup the row of buttons across the bottom. QVBoxLayout *layout = new QVBoxLayout(); // Puts everything together. layout->addLayout(header); layout->addLayout(grid); layout->addLayout(buttonRow); setLayout(layout); } // Destructor. GridWindow::~GridWindow() { delete title; } // Builds header section of the GUI. QHBoxLayout* GridWindow::setupHeader() { QHBoxLayout *header = new QHBoxLayout(); // Creates horizontal box. header->setAlignment(Qt::AlignHCenter); this->title = new QLabel("CONWAY'S GAME OF LIFE",this); // Creates big, bold, centered label (title): "Conway's Game of Life." this->title->setAlignment(Qt::AlignHCenter); this->title->setFont(QFont("Arial", 32, QFont::Bold)); header->addWidget(this->title); // Adds widget to layout. return header; // Returns header to grid window. } // Builds the grid of cells. This method populates the grid's 2D array of GridCells with MxN cells. QGridLayout* GridWindow::setupGrid(int rows,int cols) { QGridLayout *grid = new QGridLayout(); // Creates grid layout. grid->setHorizontalSpacing(0); // No empty spaces. Cells should be contiguous. grid->setVerticalSpacing(0); grid->setSpacing(0); grid->setAlignment(Qt::AlignHCenter); for(int i=0; i < rows; i++) //Each row is a vector of grid cells. { std::vector<GridCell*> row; // Creates new vector for current row. cells.push_back(row); for(int j=0; j < cols; j++) { GridCell *cell = new GridCell(); // Creates and adds new cell to row. cells.at(i).push_back(cell); grid->addWidget(cell,i,j); // Adds to cell to grid layout. Column expands vertically. grid->setColumnStretch(j,1); } grid->setRowStretch(i,1); // Sets row expansion horizontally. } return grid; // Returns grid. } // Builds footer section of the GUI. QHBoxLayout* GridWindow::setupButtonRow() { QHBoxLayout *buttonRow = new QHBoxLayout(); // Creates horizontal box for buttons. buttonRow->setAlignment(Qt::AlignHCenter); // Clear Button - Clears cell; sets them all to DEAD/white. QPushButton *clearButton = new QPushButton("CLEAR"); clearButton->setFixedSize(100,25); connect(clearButton, SIGNAL(clicked()), this, SLOT(handleClear())); buttonRow->addWidget(clearButton); // Start Button - Starts game when user clicks. Or, resumes game after being paused. QPushButton *startButton = new QPushButton("START/RESUME"); startButton->setFixedSize(100,25); connect(startButton, SIGNAL(clicked()), this, SLOT(handleStart())); buttonRow->addWidget(startButton); // Pause Button - Pauses simulation of game. QPushButton *pauseButton = new QPushButton("PAUSE"); pauseButton->setFixedSize(100,25); connect(pauseButton, SIGNAL(clicked()), this, SLOT(handlePause())); buttonRow->addWidget(pauseButton); // Quit Button - Exits program. QPushButton *quitButton = new QPushButton("EXIT"); quitButton->setFixedSize(100,25); connect(quitButton, SIGNAL(clicked()), qApp, SLOT(quit())); buttonRow->addWidget(quitButton); return buttonRow; // Returns bottom of layout. } /* SLOT method for handling clicks on the "clear" button. Receives "clicked" signals on the "Clear" button and sets all cells to DEAD. */ void GridWindow::handleClear() { for(unsigned int row=0; row < cells.size(); row++) // Loops through current rows' cells. { for(unsigned int col=0; col < cells[row].size(); col++) { GridCell *cell = cells[row][col]; // Grab the current cell & set its value to dead. cell->setType(DEAD); } } } /* SLOT method for handling clicks on the "start" button. Receives "clicked" signals on the "start" button and begins game simulation. */ void GridWindow::handleStart() { this->timer = new QTimer(this); // Creates new timer. connect(this->timer, SIGNAL(timeout()), this, SLOT(timerFired())); // Connect "timerFired" method class to the "timeout" signal fired by the timer. this->timer->start(500); // Timer to fire every 500 milliseconds. } /* SLOT method for handling clicks on the "pause" button. Receives "clicked" signals on the "pause" button and stops the game simulation. */ void GridWindow::handlePause() { this->timer->stop(); // Stops the timer. delete this->timer; // Deletes timer. } // Accessor method - Gets the 2D vector of grid cells. std::vector<std::vector<GridCell*> >& GridWindow::getCells() { return this->cells; } void GridWindow::timerFired() { // I'm not sure how to write this code. // I want to take the original vector-vector, and also make a new, empty vector-vector of the same size. // I would then go through the code below with the original vector, and apply the rules to the new vector-vector. // Finally, I would make the new vector-vecotr the original vector-vector. (That would be one step in the simulation.) cout << cells[1][2]; /* for (unsigned int m = 0; m < original.size(); m++) { for (unsigned int n = 0; n < original.at(m).size(); n++) { unsigned int neighbors = 0; //Begin counting number of neighbors. if (original[m-1][n-1].getType() == LIVE) // If a cell next to [i][j] is LIVE, add one to the neighbor count. neighbors += 1; if (original[m-1][n].getType() == LIVE) neighbors += 1; if (original[m-1][n+1].getType() == LIVE) neighbors += 1; if (original[m][n-1].getType() == LIVE) neighbors += 1; if (original[m][n+1].getType() == LIVE) neighbors += 1; if (original[m+1][n-1].getType() == LIVE) neighbors += 1; if (original[m+1][n].getType() == LIVE) neighbors += 1; if (original[m+1][n+1].getType() == LIVE) neighbors += 1; if (original[m][n].getType() == LIVE && neighbors < 2) // Apply game rules to cells: Create new, updated grid with the roundtwo vector. roundtwo[m][n].setType(LIVE); else if (original[m][n].getType() == LIVE && neighbors > 3) roundtwo[m][n].setType(DEAD); else if (original[m][n].getType() == LIVE && (neighbors == 2 || neighbors == 3)) roundtwo[m][n].setType(LIVE); else if (original[m][n].getType() == DEAD && neighbors == 3) roundtwo[m][n].setType(LIVE); } }*/ }

    Read the article

  • Workarounds for supporting MVVM in the Silverlight ContextMenu service

    - by cibrax
    As I discussed in my last post, some of the Silverlight controls does not support MVVM quite well out of the box without specific customizations. The Context Menu is another control that requires customizations for enabling data binding on the menu options. There are a few things that you might want to expose as view model for a menu item, such as the Text, the associated icon or the command that needs to be executed. That view model should look like this, public class MenuItemModel { public string Name { get; set; } public ICommand Command { get; set; } public Image Icon { get; set; } public object CommandParameter { get; set; } } This is how you can modify the built-in control to support data binding on the model above, public class CustomContextMenu : ContextMenu { protected override DependencyObject GetContainerForItemOverride() { CustomMenuItem item = new CustomMenuItem(); Binding commandBinding = new Binding("Command"); item.SetBinding(CustomMenuItem.CommandProperty, commandBinding);   Binding commandParameter = new Binding("CommandParameter"); item.SetBinding(CustomMenuItem.CommandParameterProperty, commandParameter);   return item; } }   public class CustomMenuItem : MenuItem { protected override DependencyObject GetContainerForItemOverride() { CustomMenuItem item = new CustomMenuItem();   Binding commandBinding = new Binding("Command"); item.SetBinding(CustomMenuItem.CommandProperty, commandBinding);   return item; } } The change is very similar to the one I made in the TreeView for manually data binding some of the Menu item properties to the model. Once you applied that change in the control, you can define it in your XAML like this. <toolkit:ContextMenuService.ContextMenu> <e:CustomContextMenu ItemsSource="{Binding MenuItems}"> <e:CustomContextMenu.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" > <ContentPresenter Margin="0 0 4 0" Content="{Binding Icon}" /> <TextBlock Margin="0" Text="{Binding Name, Mode=OneWay}" FontSize="12"/> </StackPanel> </DataTemplate> </e:CustomContextMenu.ItemTemplate> </e:CustomContextMenu> </toolkit:ContextMenuService.ContextMenu> The property MenuItems associated to the “ItemsSource” in the parent model just returns a list of supported options (menu items) in the context menu. this.menuItems = new MenuItemModel[] { new MenuItemModel { Name = "My Command", Command = new RelayCommand(OnCommandClick), Icon = ImageLoader.GetIcon("command.png") } }; The only problem I found so far with this approach is that the context menu service does not support a HierarchicalDataTemplate in case you want to have an hierarchy in the context menu (MenuItem –> Sub menu items), but I guess we can live without that.

    Read the article

  • How to use QSerialDevice in Qt?

    - by Tobias
    Hello, I am trying to use QSerialDevice in Qt to get a connection to my serial port. I also tried QextSerialPort before (which works on Windows Vista but unfortunately not on Windows XP ..) but I need an API which supports XP, Vista and Win7... I build the library and configured it this way: CONFIG += dll CONFIG += debug I did use the current version from SVN (0.2.0 - 2010-04-05) and the 0.2.0 zip package. After building the library I did copy it to my Qt Libdir (C:\Qt\2009.05\qt\lib) and also to C:\Windows\system32. Now I try to link against the lib in my project file: LIBS += -lqserialdevice I import the needed header (abstractserial.h) and use my own AbstractSerial like this: // Initialize this->serialPort->setDeviceName("COM1"); if (!this->serialPort->open(QIODevice::ReadWrite | QIODevice::Unbuffered)) qWarning() << "Error" << this->serialPort->errorString(); // Configure SerialPort this->serialPort->setBaudRate(AbstractSerial::BaudRate4800); this->serialPort->setDataBits(AbstractSerial::DataBits8); this->serialPort->setFlowControl(AbstractSerial::FlowControlOff); this->serialPort->setParity(AbstractSerial::ParityNone); this->serialPort->setStopBits(AbstractSerial::StopBits1); The problem is, that if I run my application, it crashes immediately with exit code -1073741515 (application failed to initialize properly). This is the same error I got using QextSerialPort under Windows XP (it worked with Windows Vista). If I build the QSerialDevice lib with release config and also my program, it crashes immediately but with exit code -1073741819 Can someone help me with this program or with another solution of getting a serial port to work with Qt (maybe another API or something?) Otherwise I have to use Windows API functions which would mean that my program won't work with UNIX systems.. If you have a solution for the problem with QextSerialPort under WinXP SP3, they are also welcome ;) Best Regards, Tobias

    Read the article

  • Any tutorial on Qt SOAP

    - by Eye of Hell
    Hello. Qt library provides a classes to work with SOAP in qt components. Unfortunately, it's not a part of 'core' Qt and is not well documented. Is it any tutorials / guides/ examples awailable i can use as starting point to learn QtSoap? I want to create a very simple SOAP client for JIRA.

    Read the article

  • Does qt 4.5 have any skins?

    - by robUK
    Hello, I am developing for the first time using qt 4.5. I am developing a desktop app that will run on windows xp/vista. The client would like to have a skin that assemblies a softphone, or something similar. Does qt come with any skinning engine? Is it possible to create skins using qt? Many thanks,

    Read the article

  • RESTful interface for C++/Qt ?

    - by Berschi
    I want to integrate the RESTful-API in my Qt-Project. I already read the example on this page, but this is only for receiving data from a RESTful-interface, not for sending new data to the server. In Java, I can use RESTlet for example, is there any possibility to use something like that for Qt, too? Or is there even a simple way to send data from Qt to RESTful, for example when I create a XML before?

    Read the article

  • Using QT to build a WYSIWYG Editor for a Custom Markup Language

    - by Aaron
    I'm new to QT, and am trying to figure out the best means of creating a WYSIWYG editor widget for a custom markup language that displays simple text, images, and links. I need to be able to propagate changes from the WYSIWYG editor to the custom markup representation. As a concrete example of the problem domain, imagine that the custom markup might have a "player" tag which contains a player name and a team name. The markup could look like this: Last week, <player id="1234"><name>Aaron Rodgers</name><team>Packers</team></player> threw a pass. This text would display in the editor as: Last week, Aaron Rodgers of the Packers threw a pass. The player name and the team name would be editable directly within the editor in standard WYSIWYG fashion, so that my users do not have to learn any markup. Also, when the player name is moused-over, a details pop-up will appear about that player, and similarly for the team. With that long introduction, I'm trying to figure out where to start with QT. It seems that the most logical option would be the Rich Text API using a QTextDocument. This approach seems less than ideal given the limitations of a QTextDocument: I can't figure out how to capture navigation events from clicking on links. Following links on click seems to only be enabled when the QTextEdit is readonly. Custom objects that implement QTextObjectInterface are ignored in copy-and-paste operations Any HTML-based markup that is passed to it as Rich Text is retranslated into a series of span tags and lots of other junk, making it extremely difficult to propagate changes from the editor back to the original custom markup. A second option appears to be QWebKit, which allows for live editing of HTML5 markup, so I could specify a two-way translation between the custom markup and HTML5. I'm not clear on how one would propagate changes from the editor back to the original markup in real-time without re-translating the entire document on every text change. The QWebKit solutions looks like awfully bulky to me (Learning WebKit along with QT) to what should be a relatively simple problem. I have also considered implementing the WYSIWYG with a custom class using native QT containers, labels, images, and other widgets manually. This seems like the most flexible approach, and the one most likely not to run into unresolvable problems. However, I'm pretty sure that implementing all the details of a normal text editor (selecting text, font changes, cut-and-paste support, undo/redo, dragging of objects, cursor placement, etc.) will be incredibly time consuming. So, finally, my question: are there any QT gurus out there with some advice on where to start with this sort of project? BTW, I am using QT because the application is a desktop application that needs platform independence.

    Read the article

  • Java to Qt code convert

    - by user289175
    Hello, I'm teaching my self Qt; in the same time I don't want to lose my Java skills in Qt. I stacked in some codes to do it in Qt, I tried many times as well as search in the net. Code # 1 Object[] names = jList1.getSelectedValues(); String msg = ""; for (Object o : names) msg += o; Code # 2 DefaultListModel model; model = new DefaultListModel(); jList1.setModel(model); Code # 3 if(!jList1.isSelectionEmpty()) I didn't find Empty method :-( I'm going to do some Qt's video tutorials on youtube, but before that I need to solve the above codes. If any programmer can help I will be thankful; Thanks in advance At the end I would like to thanks the experts who are spent thier value times to help others

    Read the article

  • what is the oldest glib version that a qt application can run with

    - by yan bellavance
    I am trying to build a standalone qt application (built on ubuntu and deployed on Red Hat 5.3, both 64 bits) after building a qt application that is statically linked to the qt library I tried to run the program on red hat and got an error saying libc.so.6 was not found and that GLIBC_2.9 or GLIBC_2.10 is not installed and needed. I tried doing a yum install glibc but then I get a message saying that glibc is up to date (its version is 2.0) I guees I am going to restart the build process but this time from a red hat installation. What do you sugges I should do in this case. My goal is to build a standalone qt application that only needs to run on red hat 5 (im pretty sure there is also going to be an issue with fontconfig.so but I can simply provide this library directly in the same directory as the app)

    Read the article

  • qt in windows7 environment

    - by sneha
    Hello everyone, i am having problem with running an example from qt which uses win32 libraries when i compile i dnt get any errors but when i run it is not able to open the application (.exe) file in windows 7.but when i compile this example in windowsXP it works fine. can anyone let me know whether i need to change my .pro file inorder to get it worked under windows 7. PLease help me out.thanks in advance. here is my .pro file # ------------------------------------------------- # Project created by QtCreator 2010-04-16T11:45:43 # ------------------------------------------------- QT += network QT += xml QT += opengl TARGET = Application TEMPLATE = app SOURCES += main.cpp \ mainwindow.cpp \ Tools.cpp \ Objects.cpp HEADERS += mainwindow.h \ Tools.h\ Objects.h unix { OBJECTS_DIR = .obj MOC_DIR = .moc } # UNIX installation isEmpty(PREFIX):PREFIX = /usr/local unix { headers.path = $$PREFIX/include/ZIP headers.files = $$HEADERS target.path = $$PREFIX/lib INSTALLS += headers \ target } !mac:x11:LIBS += -ldns_sd win32:LIBS += -ldnssd LIBPATH = C:/Temp/mDNSResponder-107.6/mDNSWindows/DLL/Debug INCLUDEPATH += c:/Temp/mDNSResponder-107.6/mDNSShared

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >