Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - jdf

Pages: [1]
1
Qt/Qtopia / My first application: Done. A few questions
« on: March 13, 2004, 09:45:11 pm »
I am new to Qt and C++ and only progran as a hobby.   I got my Z one month ago.  I just finished my first application thankx to some help from members of this board.

The app is just a Unit Conversion Program.  Wrote it as a training exercise, not because anyone needed another conversion program!   In any case I attached the source code to this message.  (don\'t expect it to be pretty).  I tested the file and it will compile and run under dev-x86-qpe environment, dev-arm-qpe and transferred to Z works fine; also under winXP envronment works fine.    The program uses customizable text files as the conversion database.  I included these data files in the attachment too.  They should be in the same directory where you run the program from.

Here are my questions:

1) What is the best way to get the application to start full screen.  What screen size should be used?   My app seems to start a little bit less than full size and then I can maximize it.

2) I use a QLabel and a QLineedit.  How can I set the color for those backgrounds?

3) The Lineedit accepts keyboard entry from the Sharp hardware.  I tried to do a connect of the textChanged signal to a Slot in mysoftware but this never works.  Maybe some one could look at that connect statement.

4) I used a setCaption, but the title doesn\'t appear in the title bar?

Sorry if some of these questions may be obvious, but I have spent hours searching and trying to resolve them.

I placed the files here too:
                                             http://www.delferro.net/zaurus

Thankx\'JDF

2
Qt/Qtopia / Newbie Qt and CPP questions: Variable Sharing
« on: March 07, 2004, 12:43:19 am »
Bear with me, I am new to CPP and am having a problem with variables.  The only reason I haven\'t given up yet, is because of the support I got off this board so far!!

I have a Class called \"HandMade\" .  Handmade is derived from QVBox class.  Handmade includes a listbox, a slider, an ADD button, a REMOVE button.  When you press ADD, whatever value the slider displays is added to listbox.  When you press delete, whatever value is current in the listbox is deleted from list box.

The HandMade class also includes another class “TicTacToe”.  Basically this is the last item in the QVBox.  

(As you can tell, I just slapped TWO example programs into ONE to learn some fundamentals!!)

Now, it all works!!  The buttons update the listbox from the slider etc..  And the tictactoe game works right along below it.  Kind of 2 independent widgets functioning on the same page.

Now HOW Can I get the TicTacToe class to TALK TO the LISTBOX in HandMade class?  For example, when I tap a box in the TicTacToe grid (call it TTT) a mousePressEvent is generated.   In TTT, the mouseevent calls a function to draw the X or O etc..  This all works fine.  

I want to add something to the mousePressEvent that will also ADD TO THE LISTBOX a number from 1 to 9.

The 2 class files are listed below my signature.  

Note that in HandMade    *lb    is a variable to reference the listbox.
I assume if “lb” was global or accessable I could just do:
     lb->insertItem( “9” );
But that doesn’t work inside the Class TicTacToe!  
I just get this error message:
Error E2451 tictactoe.cpp 50: Undefined symbol \'lb\' in function TicTacToe::mousePressEvent(QMouseEvent *)

Anyone care to help a newbie learn about this!!

Thankx in advance
JDF

***** handmaid.h ********
#ifndef HANDMADE_H
#define HANDMADE_H

// My main widget is derived from the QVBox widget
#include <qvbox.h>

// these \"forward declarations\" tell the compiler what other
// classes I WILL BE using without having to fully use
// the class declarations.  The actual class declarations are included
// in the implementation file as <qlistbox> and <qlcdnumber>.
class QLCDNumber;
class QListBox;
class TicTacToe;

// This is the start of MY new class I am making called handmade
// It is based on QVBoz class
class HandMade : public QVBox
{
  // Must have this Qt Keyword in order to use signals/slots/etc...
  Q_OBJECT

public:
  // This is the CONSTRUCTOR declaration
  HandMade( QWidget *parent=0, char *name=0 );
  QListBox *lb;
  TicTacToe *kybd;
 
  protected slots:
  // These are SLOTS
  void addNumber();
  void removeNumber();

protected:
  //These pointer values are used by the slots
  QLCDNumber *lcd;
  //QListBox *lb;
  //Need to watch the keybopard
  //TicTacToe *kybd;
   
};

#endif

***** tictactoe.h ********
#ifndef TICTACTOE_H
#define TICTACTOE_H

#include <qwidget.h>

class TicTacToe : public QWidget
{
    Q_OBJECT
public:
    TicTacToe(QWidget *parent = 0, const char *name = 0);

protected:
    void paintEvent(QPaintEvent *event);
    void mousePressEvent(QMouseEvent *event);

private:
    enum { Empty = \'-\', Cross = \'X\', Nought = \'O\' };
    QRect cellRect(int row, int col) const;
    int cellWidth() const { return width() / 3; }
    int cellHeight() const { return height() / 3; }
    char board[3][3];
};

#endif

3
Linux Applications / The "example" program : Link problems
« on: February 28, 2004, 09:47:57 am »
This is my 2nd attempt to try to install the tools for developing for the 5500.

I followed the development \"HOW TO\" exactly for configuring the compiler and loading Qt for embedix.  However, when I run make, it seems to work at first using gcc296 and then the messages start flying about undefined objects. Thousands of messages!  

In any case I am new to Linux.  I can follow instructions.  I am using Fedorar Core and I also loaded the \"compat-****\" files to get the compatible gcc.

If you have already done this, please look at the \"How to\" for compiler setup and and see if you remember any trick you needed to get it going.

Thankx John

Pages: [1]