GoToCellDialog via IDE

The Trolltech/Prentice Hall book C++ GUI Programming with Qt 4 2nd Edition is a great learners guide, but all the examples use the command line based qmake build tool. I like to do as much through an IDE as I can. So, I’ve decided to document what I’ve had to do differently in order to get the tutorials to work for me using only the IDE. My way may not be the most fluid. I’m learning C++ at the same time I’m learning how to use Qt.

I will not be going over every example, just the one’s where I felt I had a significant ah Ha moment and deviated significantly from the book. But if you find yourself stuck on something let me know and I’ll go over what I’ve done and see if there was any special tweaking needed.

I am using the free open source Windows version of Qt Creator 1.2.1 based on Qt 4.5.3 (32 bit) for learning.

You can download all the books examples at http://www.informit.com/store/product.aspx?isbn=0132354160 I will be only using the examples for Windows.

*Disclaimer: I am in no way authorized to speak for or represent Trolltech/Prentice Hall, Nokia, anyone or anything related to Qt. I’m just a computer geek who thinks that Qt totally rocks.

Okay, so this covers pages 23-29, and the extracted example files found in the chap02/gotocell2 folder :

From page 23: once Qt Creator is started instead of going through the books setup steps do the following-

-Go to File/New and when the dialog box pops up select the option Qt4 GUI Application under Projects and click OK.
-Name the project gotocelldialog and put it in a folder you’ll remember where it’s at, click next
-Make sure QtCore Module and QtGui Module are checked, then hit Next again
-On the Class Information step :
Class name: GoToCellDialog
Base class: QDialog (not QWidget)
Header, Source, and Form files should all be the same name as the Class name except all lower case. Make sure that the Generate form check box is checked and click Next
-Under the Project management dialog make sure that this isn’t going under another project (options should be grayed out) and click Finish

Page 24: now, double click the gotocelldialog.ui file and follow the instructions verbatim to create the GoToCellDialog through the IDE to page 26 where you will run the Form Preview to make sure it looks like the example.

The main.cpp, gotocelldialog.pro, .h, and .cpp files will already have been created.

Page 27: Open gotocelldialog.h . Everything is all set up except for the private slot ‘void on_lineEdit_textChanged(); ‘ declaration, so here is my code with the major change in BOLD-

#ifndef GOTOCELLDIALOG_H

#define GOTOCELLDIALOG_H

#include <QtGui/QDialog>

namespace Ui

{

class GoToCellDialog;

}

class GoToCellDialog : public QDialog

{

Q_OBJECT

public:

GoToCellDialog(QWidget *parent = 0);

~GoToCellDialog();

private:

Ui::GoToCellDialog *ui;

private slots:

void on_lineEdit_textChanged();

};

#endif // GOTOCELLDIALOG_H

—– Notice that in the book example we are not creating the Ui namspace but the IDE is.  The IDE is also creating the private *ui pointer. Important to notice.  Read on.

Page 28:

Open the implementation file gotocelldialog.cpp and add the following code shown in BOLD -

#include “gotocelldialog.h”

#include “ui_gotocelldialog.h”

GoToCellDialog::GoToCellDialog(QWidget *parent)

: QDialog(parent), ui(new Ui::GoToCellDialog)

{

ui->setupUi(this);

QRegExp regExp(“[A-Za-z][1-9][0-9]{0,2}”);

ui->lineEdit->setValidator(new QRegExpValidator(regExp, this));

}

GoToCellDialog::~GoToCellDialog()

{

delete ui;

}

void GoToCellDialog::on_lineEdit_textChanged()

{

ui->okButton->setEnabled(ui->lineEdit->hasAcceptableInput());

}

As you can see here, we need to use ui-> to access the GoToCellDialog objects and methods.

Now, what about the connects for the okButton and the cancelButton?  These can actually be setup in the IDE.  Open gotocelldialog.ui and look in the form editor for the ‘Signals and Slots editor’ tab next to the ‘Action Editor’ tab.  You will add the clicked() Signals and accept()/reject() Slots for the okButton and cancelButton as shown to be entered in the gotocelldialog.cpp .  Once you have created these and saved the changes, they can be found in the ui_gotocelldialog.h file.  Please note that you cannot make changes in the actual ui_gotocelldialog.h file because any changes will be removed when you recompile.

At this point you should be able to build and run the GoToCellDialog example and have it perform as discussed on page 29.

I hope this helps, please let me know if this is clear as mud.


Instructables: The EyeWriter

For only $50 you can make a solderless eye tracking setup.

Details and instruction can be found at Instructables.com


Misa Digital Guitar

The guitar has taken yet another evolutionary leap, this time into our digital age.


Instructables – Structured Light 3D Scanning

A very cool Instructable on how to do your own Structured Light 3D Scanning like Radio Head’s “House of Cards” video.

Point Clouds with Depth of Field from Kyle McDonald on Vimeo.


Book Review: The Ghost Brigades – John Scalzi

Polished off The Ghost Brigades last night.  To compare Old Man’s War to Ghost Brigades is like comparing a teenager to an adult.  Ghost Brigades is a bit more on the serious side, which I just realized is interesting considering the age and maturity of the characters.  For example, the main characters in Old Man’s War are 75+ years in age and approach their new leases on life from a more youthful perspective; whereas the Newborn (no previous life experience save the main character) of Ghost Brigades have but a brief glimpse of innocence before being plunged into chaos.

Anyway, Scalzi succeeds again in capturing my attention until the wee hours of the night.  I also recommend checking out his blog.


Book Review: All you need is Kill – Hiroshi Sakurazaka

What do you get when you cross the movie Groundhog Day,  some Robotech, and a dash of Armor (John Steakley)?  You get All you need is KILL.  It’s a quick read and quite enjoyable.  I also liked how the author put this from an IT guys kind of perspective.  What do I mean?  If you’re a geek, you’ll get it.  If you are a back country skier or snowboarder and can’t help but see potential runs down any mountain you look at, then maybe you can see it too.


Book Review: Old Man’s War – John Scalzi

Tonight’s book review is brought to you buy Segram’s Dry Gin, Schwepps Tonic water, and a couple drops of lime juice ;)

Oh, and about 4 hours less sleep because I couldn’t put the book down to actually go to bed last night which made my day job that much more challenging.

As the cover will tell you, this book smacks hard of the writing style of Robert Heinlein (Starship Troopers) which actually made it that much more entertaining for me. Why? Well, I’ve never read Starship Troopers, but I saw the movie.  And as I read this book I had that movie’s pace playing in my mind. Fit like a glove.  Fortunately, all female (green skinned) references did not invoke the image of Denise Richards in my mind but instead the Orion chicks out of Star Trek.

You got stereotypical military experience made complete with a hard ass (you all are dip shits!) drill sergeant,  relationship bonds made through shared conflict, lost love,  lots of free love, alien ass kicking, and a feeling that you are but a pawn in the grand scheme of things.

Now, let us say that you have been given a computer that runs in your head.  This is your personal pager, text messager, and for lack of anything better personal assistant. What name would you use?  My first choice was Bob.  Our main character thought Asshole was the most fitting.  This cracked my ass up in so many ways that I had to give my wife an explanation as to why I couldn’t quit laughing.

So anyway, for those of you who dig an entertaining quick sci-fi read, I highly recommend.  I’d also recommend this to you who like Glen Cook’s Black Company trilogy.


Tony @ Kirituhi Tattoo did not follow through

How long is long enough to wait for someone to follow through on their end of an agreement?  Six months is long enough for me, although for PayPal it’s 45 days to file a grievance and get your money back.

06 July ’09 I sent my deposit to Tony via PayPal and followed up with pics for inspiration in the creation of my tattoo.  Tony responded immediately and also suggested I add him as a friend on Facebook.  According to his email and website, I was to wait 1-4 weeks for a first draft.

After 4 weeks I had heard nothing, so I sent an email. My email did not receive a response, so I contacted him via Facebook.  Tony explained that he had some personal issues come up and was really busy, but I was not to worry, all was well.

Another 4 weeks went by, no word.  I again contacted Tony and he said it would be coming soon.  A week went by and nothing, then another week went by so I contacted him again, this time requested a refund. Tony’s response was that it was coming soon, he was close.

September past and October rolled around.  Still nothing from Tony.  So in the middle of a evening of some potent wine I sent him a WTF? message asking why he didn’t seem to give a crap and again asking for a refund.  Tony responded again with his usual ‘ I’m incredibly busy, spent countless hours on this, coming soon, sorry’.

Well, it’s a week until xmas and I’ve given up hope.  $80 US down the drain.  I hope this post will encourage others to make sure that if Tony doesn’t stick to his own terms they take the necessary steps get their money back before it’s too late.


Book Review: The Name of the Wind – Patrick Rothfuss

The Name of the WindMy latest read is The Name of the Wind by Patrick Rothfuss.  This book I HIGHLY recommend to anyone but be warned, book two is not out yet and according to his blog it is still a work in progress.

What I like most about a story is how involved I feel while reading.  I’ve always been highly visual, and once I’m into a story I zone out to the point of oblivion.  This kind of focus has helped with my career in web/software development.  I have also found myself so lost in thought that I can cover large distances while hiking and not remembering passing any or all my appointed landmarks I associate as progress until I realize I’m at the end of the trail.

Anyway, back to my point.  Rothfuss knows how to draw one in and keep you engaged.  Rarely is there a dull moment (big issue for me).  The book is told mostly from the point of view of the main character (Kvothe) retelling his past to a scribe who has come to try and get the real story of a hero’s life.  The detail was rich but not overwhelming, leaving enough for your imagination to fill in all the blanks.


Right Brain Vs Left Brain

Which direction is she spinning?  Clockwise is Right brained, and counter clockwise is Left Brained.  Your first impression is supposed to be which side is more dominant for you naturally.  I was able to get her to spin either way after taking my eyes off the picture slightly and then looking back.  Spinning-lady-5693171 Right Brain v Left Brain


  • Categories

  • Copyright © 1996-2010 Blog o' the Jimmy. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress