Feb 17 2009

Creating a Basic Window in Qt

This is a basic piece of code to get you started with the QT Jambi API. Ensure that you have the QT libraries installed before you try and run this code. IF you don’t have this then it won’t run properly and will throw an error. This displays a basic window. Nothing added to it just a basic QT Jambi Window.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import com.trolltech.qt.gui.*;
 
public class basicWindow
{
 private final int WINDOW_WIDTH = 500;
 private final int WINDOW_HEIGHT = 400;
 private QFrame frame;
 
 public basicWindow()
 {
  //create the frame
  frame = new QFrame();
 
  //create the size of the window
  frame.resize(WINDOW_WIDTH, WINDOW_HEIGHT);
 
  //create the layout for the window
  QGridLayout gridLayout = new QGridLayout();
 
  //add the layout to the main frame
  frame.setLayout(gridLayout);
  frame.show(); 
 }
 
 public static void main(String[] args)
 {
  //Used to initialize the window
  QApplication.initialize(args);
 
  //creates a new instance of the basicWindow
  new basicWindow();
 
  //runs the window as an application
  QApplication.exec();
 }
}

Cheers


Feb 17 2009

Swing vs QT Jambi

So I figured I should touch on this as I’ve been frustrated with this for a while at school. First of all I would like to say how frustrating I think java swing is…. I mean you change one thing in the layout and the entire GUI changes for some reason or another that I cannot explain…. So that is my first topic…

Java GridLayout Vs. QGridLayout

QGridLayout is coded in a way that I found extremely easy to use and manipulate. If you change one thing it doesn’t change the rest of the GUI and it keeps everything where you want it to be. You have the ability to set how big you want something to be. Then, based on the size of all the components in your display it displays the GUI in an appropriate manner. Overall the QGridLayout wins this battle.

Java Gui Components Vs. QT Components

The methods that swing uses to handle components causes an extreme amount of code that is not useful when creating a GUI. For instance, when creating a group of radio buttons, you must first create the buttons, then add the buttons to whichever group then add each individual button to a panel or something to make them appear in the GUI. This is crazy in my opinion and there is no reason that you cannot add a ButtonGroup to a panel. In QT you can add whatever component you like to a GUI. This radio button example is just that, one example and there are far too many to display here.

This is just some short thoughts on QT vs Swing, however If you try it out yourself then I’m sure you will find out which is better for yourself. Bye For Now,

Cheers


Dec 10 2008

Software at a young age

I came across an article on the very popular slashdot.com tonight that was very interesting in my opinion. The article is a user based question asking which language is best to teach 11-14 year olds with varying computer knowledge. The article found here, surprised me very much when I looked at it the first time.

Now this may be because of changing times and school’s are getting more computer literate now, but, wow, 11-14 year olds now have computer programming as part of their curriculum? This is extremely great to hear! I just wish that we would have had something like that back when I was in school and that age. Even if just basic concepts are taught like loops, variables, etc, it opens up the possibility of programming to be taught at a very young age.

This being said, I think we will see a major jump in programming skills in the next 10-20 years as more kids are now being taught these things earlier. This leads to maybe the posibility of an even easy language than maybe Basic or QBasic to be able to teach the fundamentals at a younger age.

I think that there is a dark side to this as well. Computer programming will take away from fundamental subjects such as math, science, and social studies that all kids must learn to be successful. This could be good or bad, up for you to decide…

Cheers


Dec 7 2008

Software vs. Bridges

First of all I would like to welcome you to Mark’s blog on technology. The first topic I’d like to talk about is from a book called Dreaming in code. The book says, ” Why can’t we build software like we build bridges?” We all know that bridges are usually pretty safe, sturdy, secure. All in all they rarely fail us.

I have to say, why can’t we build software like that? How many hours of man time and corporate money are wasted each year on software that is not functioning perfectly? Could the time that is spent on ill-conceived software be re-routed to perfecting it? Computers understand the code that humans put into it. So I ask… Is it possible to have a piece of software in today’s market that’s perfect? I’m talking no flaws, no errors, just perfection?

With the software changing the way it is today, I can’t answer that question. Having been coding for only about 6 months, I really am not best suited to answer that. Who can answer that question? As consumers why should we have to accept that software does not function the way we want it to? Is there not a single company out there that can make this type of software? I’m asking these questions because I think that there are companies(not naming any) that can change how the world is run. I’m not talking politically or religiously, I’m talking digitally. Almost our entire world runs on digital equipment… I mean almost everything you can think of. So why is the world putting up with digital equipment being almost “faulty”. Going back to the bridge analogy from the book dreaming in code. Imagine if bridges were built like software is built today? People would not stand for things like that to happen…

So why do we accept it with software?

Cheers