From 9ba04742771370f59740e32e11c5f3a1e6a1b70a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 5 Dec 2011 15:55:57 -0600 Subject: Initial TQt conversion --- qtjava/javalib/examples/widgets/MyWidgetView.java | 8 +- qtjava/javalib/examples/widgets/README | 2 +- qtjava/javalib/examples/widgets/WidgetView.java | 372 +++++++++++----------- qtjava/javalib/examples/widgets/trolltech.bmp | Bin 13366 -> 13368 bytes qtjava/javalib/examples/widgets/trolltech.gif | Bin 42629 -> 42635 bytes qtjava/javalib/examples/widgets/tt-logo.png | Bin 4547 -> 4548 bytes 6 files changed, 191 insertions(+), 191 deletions(-) (limited to 'qtjava/javalib/examples/widgets') diff --git a/qtjava/javalib/examples/widgets/MyWidgetView.java b/qtjava/javalib/examples/widgets/MyWidgetView.java index db42cb9a..968a13ea 100644 --- a/qtjava/javalib/examples/widgets/MyWidgetView.java +++ b/qtjava/javalib/examples/widgets/MyWidgetView.java @@ -19,7 +19,7 @@ public MyWidgetView( ) this(null, null); } -public MyWidgetView( QWidget parent, String name ) +public MyWidgetView( TQWidget parent, String name ) { super(parent, name); s = 0; @@ -28,7 +28,7 @@ public MyWidgetView( QWidget parent, String name ) void button1Clicked() { - ArrayList styles = QStyleFactory.keys(); + ArrayList styles = TQStyleFactory.keys(); s = (++s)%styles.size(); qApp().setStyle( (String) styles.get(s) ); @@ -42,8 +42,8 @@ public MyWidgetView( QWidget parent, String name ) public static void main(String[] args) { - QApplication.setColorSpec( QApplication.CustomColor ); - QApplication a = new QApplication( args ); + TQApplication.setColorSpec( TQApplication.CustomColor ); + TQApplication a = new TQApplication( args ); MyWidgetView w = new MyWidgetView(); a.setMainWidget( w ); diff --git a/qtjava/javalib/examples/widgets/README b/qtjava/javalib/examples/widgets/README index 8e1767e4..46a11824 100644 --- a/qtjava/javalib/examples/widgets/README +++ b/qtjava/javalib/examples/widgets/README @@ -1,4 +1,4 @@ Click the right mouse button + CTRL to identify a widget. The classes MyWhatsThis and MyMenuItem can't be translated to java -yet, as the required virtual methods callbacks aren't implemented +yet, as the retquired virtual methods callbacks aren't implemented diff --git a/qtjava/javalib/examples/widgets/WidgetView.java b/qtjava/javalib/examples/widgets/WidgetView.java index d000ce8b..2907f49c 100644 --- a/qtjava/javalib/examples/widgets/WidgetView.java +++ b/qtjava/javalib/examples/widgets/WidgetView.java @@ -15,23 +15,23 @@ import org.kde.qt.*; -class WidgetView extends QMainWindow +class WidgetView extends TQMainWindow { private String MOVIEFILENAME = "trolltech.gif"; -private QLabel msg; -private QCheckBox cb[] = new QCheckBox[3]; -private QGroupBox bg; -private QLabel movielabel; -private QMovie movie; -private QWidget central; -private QProgressBar prog; +private TQLabel msg; +private TQCheckBox cb[] = new TQCheckBox[3]; +private TQGroupBox bg; +private TQLabel movielabel; +private TQMovie movie; +private TQWidget central; +private TQProgressBar prog; private int progress; -private QTabWidget tabs; -private QMultiLineEdit edit; -private QPopupMenu textStylePopup; +private TQTabWidget tabs; +private TQMultiLineEdit edit; +private TQPopupMenu textStylePopup; private int plainStyleID; -private QWidget bla; +private TQWidget bla; private AnalogClock aclock; private DigitalClock dclock; @@ -110,23 +110,23 @@ static String[] fileprint = { -class MyListView extends QListView +class MyListView extends TQListView { -public MyListView( QWidget parent ) +public MyListView( TQWidget parent ) { this(parent, null); } -public MyListView( QWidget parent, String name ) +public MyListView( TQWidget parent, String name ) { super( parent, name ); selected = null; } -protected void contentsMousePressEvent( QMouseEvent e ) +protected void contentsMousePressEvent( TQMouseEvent e ) { selected = selectedItem(); // super.contentsMousePressEvent( e ); } -protected void contentsMouseReleaseEvent( QMouseEvent e ) +protected void contentsMouseReleaseEvent( TQMouseEvent e ) { // super.contentsMouseReleaseEvent( e ); if ( selectedItem() != selected ) { @@ -135,7 +135,7 @@ protected void contentsMouseReleaseEvent( QMouseEvent e ) } } -private QListViewItem selected; +private TQListViewItem selected; } // // WidgetView contains lots of Qt widgets. @@ -150,38 +150,38 @@ private QListViewItem selected; /* -class MyWhatsThis extends QWhatsThis +class MyWhatsThis extends TQWhatsThis { -public MyWhatsThis( QListBox lb) +public MyWhatsThis( TQListBox lb) { super( lb ); listbox = lb; } -public String text( QPoint p) { - QListBoxItem i = listbox.itemAt( p ); +public String text( TQPoint p) { + TQListBoxItem i = listbox.itemAt( p ); if ( i != null && i.pixmap() != null ) { return "Isn't that a wonderful pixmap?
" + "Imagine, you could even decorate a" + " red pushbutton with it! :-)"; } - return "This is a QListBox."; + return "This is a TQListBox."; } -private QListBox listbox; +private TQListBox listbox; } -class MyMenuItem extends QCustomMenuItem +class MyMenuItem extends TQCustomMenuItem { -public MyMenuItem( String s, QFont f ) +public MyMenuItem( String s, TQFont f ) { string = s; font = f; } - public void paint( QPainter p, QColorGroup cg, boolean act, + public void paint( TQPainter p, TQColorGroup cg, boolean act, boolean enabled, int x, int y, int w, int h ) { p.setFont ( font ); @@ -190,13 +190,13 @@ public MyMenuItem( String s, QFont f ) string ); } - public QSize sizeHint() + public TQSize sizeHint() { - return QFontMetrics( font ).size( AlignAuto | AlignVCenter | + return TQFontMetrics( font ).size( AlignAuto | AlignVCenter | ShowPrefix | DontClip, string ); } private String string; -private QFont font; +private TQFont font; } */ @@ -205,40 +205,40 @@ private QFont font; // Construct the WidgetView with children // -WidgetView( QWidget parent, String name ) +WidgetView( TQWidget parent, String name ) { super( parent, name ); - QColor col = new QColor(); + TQColor col = new TQColor(); // Set the window caption/title setCaption( "Qt Example - Widgets Demo Application" ); // create a toolbar - QToolBar tools = new QToolBar( this, "toolbar" ); + TQToolBar tools = new TQToolBar( this, "toolbar" ); // put something in it - QPixmap openIcon = new QPixmap( fileopen ); - QToolButton toolb = new QToolButton( new QIconSet(openIcon), "toolbutton 1", + TQPixmap openIcon = new TQPixmap( fileopen ); + TQToolButton toolb = new TQToolButton( new TQIconSet(openIcon), "toolbutton 1", "", this, SLOT("open()"), tools, "open file" ); - QWhatsThis.add( toolb, "This is a QToolButton. It lives in a " - + "QToolBar. This particular button doesn't do anything " + TQWhatsThis.add( toolb, "This is a TQToolButton. It lives in a " + + "TQToolBar. This particular button doesn't do anything " + "useful." ); - QPixmap saveIcon = new QPixmap( filesave ); - toolb = new QToolButton( new QIconSet(saveIcon), "toolbutton 2", "", + TQPixmap saveIcon = new TQPixmap( filesave ); + toolb = new TQToolButton( new TQIconSet(saveIcon), "toolbutton 2", "", this, SLOT("dummy()"), tools, "save file" ); - QWhatsThis.add( toolb, "This is also a QToolButton." ); + TQWhatsThis.add( toolb, "This is also a TQToolButton." ); - QPixmap printIcon = new QPixmap( fileprint ); - toolb = new QToolButton( new QIconSet(printIcon), "toolbutton 3", "", + TQPixmap printIcon = new TQPixmap( fileprint ); + toolb = new TQToolButton( new TQIconSet(printIcon), "toolbutton 3", "", this, SLOT("dummy()"), tools, "print file" ); - QWhatsThis.add( toolb, "This is the third QToolButton."); + TQWhatsThis.add( toolb, "This is the third TQToolButton."); - toolb = QWhatsThis.whatsThisButton( tools ); - QWhatsThis.add( toolb, "This is a What's This button " + toolb = TQWhatsThis.whatsThisButton( tools ); + TQWhatsThis.add( toolb, "This is a What's This button " + "It enables the user to ask for help " + "about widgets on the screen."); @@ -246,51 +246,51 @@ WidgetView( QWidget parent, String name ) qApp().installEventFilter( this ); //make a central widget to contain the other widgets - central = new QWidget( this ); + central = new TQWidget( this ); setCentralWidget( central ); // Create a layout to position the widgets - QHBoxLayout topLayout = new QHBoxLayout( central, 10 ); + TQHBoxLayout topLayout = new TQHBoxLayout( central, 10 ); // Create a grid layout to hold most of the widgets - QGridLayout grid = new QGridLayout( 0, 3 ); //3 wide and autodetect number of rows + TQGridLayout grid = new TQGridLayout( 0, 3 ); //3 wide and autodetect number of rows topLayout.addLayout( grid, 1 ); // Create an easter egg - QToolTip.add( menuBar(), new QRect( 0, 0, 2, 2 ), "easter egg" ); + TQToolTip.add( menuBar(), new TQRect( 0, 0, 2, 2 ), "easter egg" ); - QPopupMenu popup; - popup = new QPopupMenu( this ); + TQPopupMenu popup; + popup = new TQPopupMenu( this ); menuBar().insertItem( "&File", popup ); int id; id = popup.insertItem( "&New" ); popup.setItemEnabled( id, false ); - id = popup.insertItem( new QIconSet(openIcon), "&Open", this, SLOT(" open()") ); + id = popup.insertItem( new TQIconSet(openIcon), "&Open", this, SLOT(" open()") ); popup.insertSeparator(); - popup.insertItem( "&Quit", qApp(), SLOT("quit()"), new QKeySequence(CTRL+Key_Q) ); + popup.insertItem( "&Quit", qApp(), SLOT("quit()"), new TQKeySequence(CTRL+Key_Q) ); - textStylePopup = popup = new QPopupMenu( this ); + textStylePopup = popup = new TQPopupMenu( this ); menuBar().insertItem( "&Edit", popup ); plainStyleID = id = popup.insertItem( "&Plain" ); - popup.setAccel( new QKeySequence(CTRL+Key_T), id ); + popup.setAccel( new TQKeySequence(CTRL+Key_T), id ); popup.insertSeparator(); -/* QFont f = font(); +/* TQFont f = font(); f.setBold( true ); id = popup.insertItem( new MyMenuItem( "&Bold", f ) ); - popup.setAccel( new QKeySequence(CTRL+Key_B), id ); + popup.setAccel( new TQKeySequence(CTRL+Key_B), id ); f = font(); f.setItalic( true ); id = popup.insertItem( new MyMenuItem( "&Italic", f ) ); popup.setItemChecked( id, true ); - popup.setAccel( new QKeySequence(CTRL+Key_I), id ); + popup.setAccel( new TQKeySequence(CTRL+Key_I), id ); f = font(); f.setUnderline( true ); id = popup.insertItem( new MyMenuItem( "&Underline", f ) ); - popup.setAccel( new QKeySequence(CTRL+Key_U), id ); + popup.setAccel( new TQKeySequence(CTRL+Key_U), id ); f = font(); f.setStrikeOut( true ); id = popup.insertItem( new MyMenuItem( "&Strike", f ) ); @@ -307,101 +307,101 @@ WidgetView( QWidget parent, String name ) // Give the dclock widget a blue palette col.setRgb( 0xaa, 0xbe, 0xff ); - dclock.setPalette( new QPalette( col ) ); + dclock.setPalette( new TQPalette( col ) ); // make tool tips for both of them - QToolTip.add( aclock, "custom widget: analog clock" ); - QToolTip.add( dclock, "custom widget: digital clock" ); + TQToolTip.add( aclock, "custom widget: analog clock" ); + TQToolTip.add( dclock, "custom widget: digital clock" ); // Create a push button. - QPushButton pb; - pb = new QPushButton( "&Push button 1", central, "button1" ); + TQPushButton pb; + pb = new TQPushButton( "&Push button 1", central, "button1" ); grid.addWidget( pb, 0, 0, AlignVCenter ); connect( pb, SIGNAL("clicked()"), SLOT("button1Clicked()") ); - QToolTip.add( pb, "push button 1" ); - QWhatsThis.add( pb, "This is a QPushButton.
" + TQToolTip.add( pb, "push button 1" ); + TQWhatsThis.add( pb, "This is a TQPushButton.
" + "Click it and watch...
" + "The wonders of modern technology."); - QPixmap pm = new QPixmap(); + TQPixmap pm = new TQPixmap(); boolean pix = pm.load("qt.png"); if ( !pix ) { - QMessageBox.information( null, "Qt Widgets Example", + TQMessageBox.information( null, "Qt Widgets Example", "Could not load the file \"qt.png\", which\n" + "contains an icon used...\n\n" + "The text \"line 42\" will be substituted.", - QMessageBox.Ok + QMessageBox.Default ); + TQMessageBox.Ok + TQMessageBox.Default ); } - // Create a label containing a QMovie - movie = new QMovie( MOVIEFILENAME ); - movielabel = new QLabel( central, "label0" ); + // Create a label containing a TQMovie + movie = new TQMovie( MOVIEFILENAME ); + movielabel = new TQLabel( central, "label0" ); movie.connectStatus(this, SLOT("movieStatus(int)")); - movie.connectUpdate(this, SLOT("movieUpdate(QRect)")); - movielabel.setFrameStyle( QFrame.Box | QFrame.Plain ); + movie.connectUpdate(this, SLOT("movieUpdate(TQRect)")); + movielabel.setFrameStyle( TQFrame.Box | TQFrame.Plain ); movielabel.setMovie( movie ); movielabel.setFixedSize( 128+movielabel.frameWidth()*2, 64+movielabel.frameWidth()*2 ); grid.addWidget( movielabel, 0, 1, AlignCenter ); - QToolTip.add( movielabel, "movie" ); - QWhatsThis.add( movielabel, "This is a QLabel " - + "that contains a QMovie." ); + TQToolTip.add( movielabel, "movie" ); + TQWhatsThis.add( movielabel, "This is a TQLabel " + + "that contains a TQMovie." ); // Create a group of check boxes - bg = new QButtonGroup( central, "checkGroup" ); + bg = new TQButtonGroup( central, "checkGroup" ); bg.setTitle( "Check Boxes" ); grid.addWidget( bg, 1, 0 ); // Create a layout for the check boxes - QVBoxLayout vbox = new QVBoxLayout(bg, 10); + TQVBoxLayout vbox = new TQVBoxLayout(bg, 10); vbox.addSpacing( bg.fontMetrics().height() ); - cb[0] = new QCheckBox( bg ); + cb[0] = new TQCheckBox( bg ); cb[0].setText( "&Read" ); vbox.addWidget( cb[0] ); - cb[1] = new QCheckBox( bg ); + cb[1] = new TQCheckBox( bg ); cb[1].setText( "&Write" ); vbox.addWidget( cb[1] ); - cb[2] = new QCheckBox( bg ); + cb[2] = new TQCheckBox( bg ); cb[2].setText( "&Execute" ); vbox.addWidget( cb[2] ); connect( bg, SIGNAL("clicked(int)"), SLOT("checkBoxClicked(int)") ); - QToolTip.add( cb[0], "check box 1" ); - QToolTip.add( cb[1], "check box 2" ); - QToolTip.add( cb[2], "check box 3" ); + TQToolTip.add( cb[0], "check box 1" ); + TQToolTip.add( cb[1], "check box 2" ); + TQToolTip.add( cb[2], "check box 3" ); // Create a group of radio buttons - QRadioButton rb; - bg = new QButtonGroup( central, "radioGroup" ); + TQRadioButton rb; + bg = new TQButtonGroup( central, "radioGroup" ); bg.setTitle( "Radio buttons" ); grid.addWidget( bg, 1, 1 ); // Create a layout for the radio buttons - vbox = new QVBoxLayout(bg, 10); + vbox = new TQVBoxLayout(bg, 10); vbox.addSpacing( bg.fontMetrics().height() ); - rb = new QRadioButton( bg ); + rb = new TQRadioButton( bg ); rb.setText( "&AM" ); rb.setChecked( true ); vbox.addWidget(rb); - QToolTip.add( rb, "radio button 1" ); - rb = new QRadioButton( bg ); + TQToolTip.add( rb, "radio button 1" ); + rb = new TQRadioButton( bg ); rb.setText( "F&M" ); vbox.addWidget(rb); - QToolTip.add( rb, "radio button 2" ); - rb = new QRadioButton( bg ); + TQToolTip.add( rb, "radio button 2" ); + rb = new TQRadioButton( bg ); rb.setText( "&Short Wave" ); vbox.addWidget(rb); connect( bg, SIGNAL("clicked(int)"), SLOT("radioButtonClicked(int)") ); - QToolTip.add( rb, "radio button 3" ); + TQToolTip.add( rb, "radio button 3" ); // Create a list box - QListBox lb = new QListBox( central, "listBox" ); + TQListBox lb = new TQListBox( central, "listBox" ); for ( int i=0; i<100; i++ ) { // fill list box String str = "line " + i; if ( i == 42 && pix ) @@ -411,27 +411,27 @@ WidgetView( QWidget parent, String name ) } grid.addMultiCellWidget( lb, 2, 4, 0, 0 ); connect( lb, SIGNAL("selected(int)"), SLOT("listBoxItemSelected(int)") ); - QToolTip.add( lb, "list box" ); + TQToolTip.add( lb, "list box" ); // new MyWhatsThis( lb ); - vbox = new QVBoxLayout(8); + vbox = new TQVBoxLayout(8); grid.addLayout( vbox, 2, 1 ); // Create a slider - QSlider sb = new QSlider( 0, 300, 30, 100, QSlider.Horizontal, + TQSlider sb = new TQSlider( 0, 300, 30, 100, TQSlider.Horizontal, central, "Slider" ); - sb.setTickmarks( QSlider.Below ); + sb.setTickmarks( TQSlider.Below ); sb.setTickInterval( 10 ); - sb.setFocusPolicy( QWidget.TabFocus ); + sb.setFocusPolicy( TQWidget.TabFocus ); vbox.addWidget( sb ); connect( sb, SIGNAL("valueChanged(int)"), SLOT("sliderValueChanged(int)") ); - QToolTip.add( sb, "slider" ); - QWhatsThis.add( sb, "This is a QSlider. " + TQToolTip.add( sb, "slider" ); + TQWhatsThis.add( sb, "This is a TQSlider. " + "The tick marks are optional." + " This slider controls the speed of the movie." ); // Create a combo box - QComboBox combo = new QComboBox( false, central, "comboBox" ); + TQComboBox combo = new TQComboBox( false, central, "comboBox" ); combo.insertItem( "darkBlue" ); combo.insertItem( "darkRed" ); combo.insertItem( "darkGreen" ); @@ -440,10 +440,10 @@ WidgetView( QWidget parent, String name ) vbox.addWidget( combo ); connect( combo, SIGNAL("activated(int)"), this, SLOT("comboBoxItemActivated(int)") ); - QToolTip.add( combo, "read-only combo box" ); + TQToolTip.add( combo, "read-only combo box" ); // Create an editable combo box - QComboBox edCombo = new QComboBox( true, central, "edComboBox" ); + TQComboBox edCombo = new TQComboBox( true, central, "edComboBox" ); edCombo.insertItem( "Permutable" ); edCombo.insertItem( "Malleable" ); edCombo.insertItem( "Adaptable" ); @@ -452,21 +452,21 @@ WidgetView( QWidget parent, String name ) vbox.addWidget( edCombo ); connect( edCombo, SIGNAL("activated(String)"), this, SLOT("edComboBoxItemActivated(String)") ); - QToolTip.add( edCombo, "editable combo box" ); + TQToolTip.add( edCombo, "editable combo box" ); edCombo.setAutoCompletion( true ); - vbox = new QVBoxLayout(8); + vbox = new TQVBoxLayout(8); grid.addLayout( vbox, 2, 2 ); // Create a spin box - QSpinBox spin = new QSpinBox( 0, 10, 1, central, "spin" ); + TQSpinBox spin = new TQSpinBox( 0, 10, 1, central, "spin" ); spin.setSuffix(" mm"); spin.setSpecialValueText( "Auto" ); connect( spin, SIGNAL(" valueChanged(String)"), SLOT(" spinBoxValueChanged(String)") ); - QToolTip.add( spin, "spin box" ); - QWhatsThis.add( spin, "This is a QSpinBox. " + TQToolTip.add( spin, "spin box" ); + TQWhatsThis.add( spin, "This is a TQSpinBox. " + "You can chose values in a given range " + "either by using the arrow buttons " + "or by typing them in." ); @@ -475,22 +475,22 @@ WidgetView( QWidget parent, String name ) vbox.addStretch( 1 ); // Create a tabwidget that switches between multi line edits - tabs = new QTabWidget( central ); - //tabs.setTabPosition( QTabWidget.Bottom ); + tabs = new TQTabWidget( central ); + //tabs.setTabPosition( TQTabWidget.Bottom ); tabs.setMargin( 4 ); grid.addMultiCellWidget( tabs, 3, 3, 1, 2 ); - QMultiLineEdit mle = new QMultiLineEdit( tabs, "multiLineEdit" ); + TQMultiLineEdit mle = new TQMultiLineEdit( tabs, "multiLineEdit" ); edit = mle; - mle.setWordWrap( QMultiLineEdit.WidgetWidth ); - mle.setText("This is a QMultiLineEdit widget, " + mle.setWordWrap( TQMultiLineEdit.WidgetWidth ); + mle.setText("This is a TQMultiLineEdit widget, " + "useful for small multi-line " + "input fields."); - QToolTip.add( mle, "multi line editor" ); + TQToolTip.add( mle, "multi line editor" ); tabs.addTab( mle, "F&irst"); - mle = new QMultiLineEdit( tabs, "multiLineEdit" ); - String mleText = "This is another QMultiLineEdit widget."; + mle = new TQMultiLineEdit( tabs, "multiLineEdit" ); + String mleText = "This is another TQMultiLineEdit widget."; mleText += "\n"; mleText += "Japanese: "; mleText += (char) 0x6a38; // Kanji @@ -502,22 +502,22 @@ WidgetView( QWidget parent, String name ) mleText += (char) 0x00d8; // Norwegian mleText += "\n"; mleText += "Unicode (black square):"; - mleText += (char) 0x25A0; // BLACK SQUARE + mleText += (char) 0x25A0; // BLACK STQUARE mleText += "\n"; mle.setText( mleText ); - QToolTip.add( mle, "second multi line editor" ); + TQToolTip.add( mle, "second multi line editor" ); tabs.addTab( mle, "Se&cond"); // Create a single line edit - QLineEdit le = new QLineEdit( central, "lineEdit" ); + TQLineEdit le = new TQLineEdit( central, "lineEdit" ); grid.addMultiCellWidget( le, 4, 4, 1, 2 ); connect( le, SIGNAL("textChanged(String)"), SLOT("lineEditTextChanged(String)") ); - QToolTip.add( le, "single line editor" ); - QWhatsThis.add( le, "This is a QLineEdit, you can enter a " + TQToolTip.add( le, "single line editor" ); + TQWhatsThis.add( le, "This is a TQLineEdit, you can enter a " + "single line of text in it. " + "It also it accepts text drops." ); @@ -532,85 +532,85 @@ WidgetView( QWidget parent, String name ) grid.setColStretch(2,1); - QSplitter split = new QSplitter( Vertical, central, "splitter" ); + TQSplitter split = new TQSplitter( Vertical, central, "splitter" ); split.setOpaqueResize( true ); topLayout.addWidget( split, 1 ); - QListView lv = new MyListView( split ); + TQListView lv = new MyListView( split ); connect(lv, SIGNAL("selectionChanged()"), this, SLOT(" selectionChanged()") ); - connect(lv, SIGNAL("selectionChanged(QListViewItem)"), - this, SLOT(" selectionChanged(QListViewItem)") ); - connect(lv, SIGNAL("clicked(QListViewItem)"), - this, SLOT(" clicked(QListViewItem)") ); - connect(lv, SIGNAL("mySelectionChanged(QListViewItem)"), - this, SLOT(" mySelectionChanged(QListViewItem)") ); + connect(lv, SIGNAL("selectionChanged(TQListViewItem)"), + this, SLOT(" selectionChanged(TQListViewItem)") ); + connect(lv, SIGNAL("clicked(TQListViewItem)"), + this, SLOT(" clicked(TQListViewItem)") ); + connect(lv, SIGNAL("mySelectionChanged(TQListViewItem)"), + this, SLOT(" mySelectionChanged(TQListViewItem)") ); lv.addColumn( "One" ); lv.addColumn( "Two" ); lv.setAllColumnsShowFocus( true ); - QListViewItem lvi= new QListViewItem( lv, "Text", "Text" ); - lvi= new QListViewItem( lv, "Text", "Other Text" ); - lvi= new QListViewItem( lv, "Text", "More Text" ); - lvi= new QListViewItem( lv, "Text", "Extra Text" ); + TQListViewItem lvi= new TQListViewItem( lv, "Text", "Text" ); + lvi= new TQListViewItem( lv, "Text", "Other Text" ); + lvi= new TQListViewItem( lv, "Text", "More Text" ); + lvi= new TQListViewItem( lv, "Text", "Extra Text" ); lvi.setOpen(true); - new QListViewItem( lvi, "SubText", "Additional Text" ); - lvi= new QListViewItem( lvi, "SubText", "Side Text" ); - lvi= new QListViewItem( lvi, "SubSubText", "Complimentary Text" ); + new TQListViewItem( lvi, "SubText", "Additional Text" ); + lvi= new TQListViewItem( lvi, "SubText", "Side Text" ); + lvi= new TQListViewItem( lvi, "SubSubText", "Complimentary Text" ); - QToolTip.add( lv, "list view" ); - QWhatsThis.add( lv, "This is a QListView, you can display lists " + TQToolTip.add( lv, "list view" ); + TQWhatsThis.add( lv, "This is a TQListView, you can display lists " + "(or outline lists) of multiple-column data in it." ); - lv = new QListView( split ); + lv = new TQListView( split ); lv.addColumn( "Choices" ); - new QCheckListItem( lv, "Onion", QCheckListItem.CheckBox ); - new QCheckListItem( lv, "Artichoke", QCheckListItem.CheckBox ); - new QCheckListItem( lv, "Pepper", QCheckListItem.CheckBox ); - new QCheckListItem( lv, "Habaneros", QCheckListItem.CheckBox ); - new QCheckListItem( lv, "Pineapple", QCheckListItem.CheckBox ); - new QCheckListItem( lv, "Ham", QCheckListItem.CheckBox ); - new QCheckListItem( lv, "Pepperoni", QCheckListItem.CheckBox ); - new QCheckListItem( lv, "Garlic", QCheckListItem.CheckBox ); + new TQCheckListItem( lv, "Onion", TQCheckListItem.CheckBox ); + new TQCheckListItem( lv, "Artichoke", TQCheckListItem.CheckBox ); + new TQCheckListItem( lv, "Pepper", TQCheckListItem.CheckBox ); + new TQCheckListItem( lv, "Habaneros", TQCheckListItem.CheckBox ); + new TQCheckListItem( lv, "Pineapple", TQCheckListItem.CheckBox ); + new TQCheckListItem( lv, "Ham", TQCheckListItem.CheckBox ); + new TQCheckListItem( lv, "Pepperoni", TQCheckListItem.CheckBox ); + new TQCheckListItem( lv, "Garlic", TQCheckListItem.CheckBox ); - QCheckListItem lit = new QCheckListItem( lv, "Cheese" ); + TQCheckListItem lit = new TQCheckListItem( lv, "Cheese" ); lit.setOpen( true ); - new QCheckListItem( lit, "Cheddar", QCheckListItem.RadioButton ); - new QCheckListItem( lit, "Mozarella", QCheckListItem.RadioButton ); - new QCheckListItem( lit, "Jarlsberg", QCheckListItem.RadioButton ); + new TQCheckListItem( lit, "Cheddar", TQCheckListItem.RadioButton ); + new TQCheckListItem( lit, "Mozarella", TQCheckListItem.RadioButton ); + new TQCheckListItem( lit, "Jarlsberg", TQCheckListItem.RadioButton ); - QToolTip.add( lv, "list view" ); - QWhatsThis.add( lv, "This is also a QListView, with " + TQToolTip.add( lv, "list view" ); + TQWhatsThis.add( lv, "This is also a TQListView, with " + "interactive items." ); - QTextView qmlv = new QTextView( "

QTextView

" + TQTextView qmlv = new TQTextView( "

TQTextView

" + "

Qt supports formatted rich text, such " + "as the heading above, emphasized and " + "bold text, via an XML subset.

" + "

Style sheets are supported.

", "", split ); - qmlv.setFont(new QFont("Charter",11)); - qmlv.setFrameStyle( QFrame.WinPanel | QFrame.Sunken ); + qmlv.setFont(new TQFont("Charter",11)); + qmlv.setFrameStyle( TQFrame.WinPanel | TQFrame.Sunken ); // Create an label and a message in the status bar // The message is updated when buttons are clicked etc. - msg = new QLabel( statusBar(), "message" ); + msg = new TQLabel( statusBar(), "message" ); msg.setAlignment( AlignCenter ); - QFont boldfont = new QFont(); boldfont.setWeight(QFont.Bold); + TQFont boldfont = new TQFont(); boldfont.setWeight(TQFont.Bold); msg.setFont( boldfont ); statusBar().addWidget( msg, 4 ); - QToolTip.add( msg, "Message area" ); + TQToolTip.add( msg, "Message area" ); - QAccel a = new QAccel( this ); - a.connectItem( a.insertItem( new QKeySequence(Key_F9) ), + TQAccel a = new TQAccel( this ); + a.connectItem( a.insertItem( new TQKeySequence(Key_F9) ), this, SLOT(" showProperties()") ); - prog = new QProgressBar( statusBar(), "progress" ); + prog = new TQProgressBar( statusBar(), "progress" ); prog.setTotalSteps( 100 ); progress = 64; prog.setProgress( progress ); statusBar().addWidget( prog , 1 ); - QWhatsThis.add( prog, "This is a QProgressBar " + TQWhatsThis.add( prog, "This is a TQProgressBar " + "You can use it to show that a lengthy " + " process is progressing. " + "In this program, nothing much seems to happen." ); @@ -629,7 +629,7 @@ void button1Clicked() } -void movieUpdate( QRect r ) +void movieUpdate( TQRect r ) { // Uncomment this to test animated icons on your window manager //setIcon( movie.framePixmap() ); @@ -638,10 +638,10 @@ void movieUpdate( QRect r ) void movieStatus( int s ) { switch ( s ) { - case QMovie.SourceEmpty: - case QMovie.UnrecognizedFormat: + case TQMovie.SourceEmpty: + case TQMovie.UnrecognizedFormat: { - QPixmap pm = new QPixmap("tt-logo.png"); + TQPixmap pm = new TQPixmap("tt-logo.png"); movielabel.setPixmap(pm); movielabel.setFixedSize(pm.size()); } @@ -710,19 +710,19 @@ void comboBoxItemActivated( int index ) switch ( index ) { default: case 0: - QApplication.setWinStyleHighlightColor( darkBlue() ); + TQApplication.setWinStyleHighlightColor( darkBlue() ); break; case 1: - QApplication.setWinStyleHighlightColor( darkRed() ); + TQApplication.setWinStyleHighlightColor( darkRed() ); break; case 2: - QApplication.setWinStyleHighlightColor( darkGreen() ); + TQApplication.setWinStyleHighlightColor( darkGreen() ); break; case 3: - QApplication.setWinStyleHighlightColor( blue() ); + TQApplication.setWinStyleHighlightColor( blue() ); break; case 4: - QApplication.setWinStyleHighlightColor( red() ); + TQApplication.setWinStyleHighlightColor( red() ); break; } } @@ -757,12 +757,12 @@ void spinBoxValueChanged( String valueText ) static boolean identify_now = true; -public boolean eventFilter( QObject obj, QEvent event ) +public boolean eventFilter( TQObject obj, TQEvent event ) { - if ( event.type() == QEvent.MouseButtonPress && event instanceof QMouseEvent && identify_now ) { - QMouseEvent e = (QMouseEvent)event; - if ( e.button() == QMouseEvent.RightButton && - (e.state() & QMouseEvent.ControlButton) != 0 ){ + if ( event.type() == TQEvent.MouseButtonPress && event instanceof TQMouseEvent && identify_now ) { + TQMouseEvent e = (TQMouseEvent)event; + if ( e.button() == TQMouseEvent.RightButton && + (e.state() & TQMouseEvent.ControlButton) != 0 ){ String str = "The clicked widget is a\n"; str += obj.className(); str += "\nThe widget's name is\n"; @@ -771,7 +771,7 @@ public boolean eventFilter( QObject obj, QEvent event ) else str += ""; identify_now = false; // don't do it in message box - QMessageBox.information( (QWidget)obj, "Identify Widget", str ); + TQMessageBox.information( (TQWidget)obj, "Identify Widget", str ); identify_now = true; // allow it again } } @@ -782,13 +782,13 @@ public boolean eventFilter( QObject obj, QEvent event ) void open() { - QFileDialog.getOpenFileName( "", "Textfiles (.txt)", this ); + TQFileDialog.getOpenFileName( "", "Textfiles (.txt)", this ); } void dummy() { - QMessageBox.information( this, "Sorry", + TQMessageBox.information( this, "Sorry", "This function is not implemented" ); } @@ -796,17 +796,17 @@ void selectionChanged() { //qDebug("selectionChanged"); } -void selectionChanged( QListViewItem item) +void selectionChanged( TQListViewItem item) { //qDebug("selectionChanged %p", item ); } -void clicked( QListViewItem item ) +void clicked( TQListViewItem item ) { //qDebug("clicked %p", item ); } -void mySelectionChanged( QListViewItem item ) +void mySelectionChanged( TQListViewItem item ) { //qDebug("mySelectionChanged %p", item ); } @@ -818,7 +818,7 @@ void showProperties() String output = "Properties for class '" + qApp().focusWidget().className() + "'"; int i = 0; while( i < (int) qApp().focusWidget().metaObject().numProperties( true ) ) { - QMetaProperty p + TQMetaProperty p = qApp().focusWidget().metaObject().property( i, true ); String tmp = "\n " + (++i) + ": " + p.name() + " (read-" + (p.writable() ? "write" : "only") + ", " + p.type() + ")"; diff --git a/qtjava/javalib/examples/widgets/trolltech.bmp b/qtjava/javalib/examples/widgets/trolltech.bmp index 01a56a2e..18899f2b 100644 Binary files a/qtjava/javalib/examples/widgets/trolltech.bmp and b/qtjava/javalib/examples/widgets/trolltech.bmp differ diff --git a/qtjava/javalib/examples/widgets/trolltech.gif b/qtjava/javalib/examples/widgets/trolltech.gif index f674369e..02c13b14 100644 Binary files a/qtjava/javalib/examples/widgets/trolltech.gif and b/qtjava/javalib/examples/widgets/trolltech.gif differ diff --git a/qtjava/javalib/examples/widgets/tt-logo.png b/qtjava/javalib/examples/widgets/tt-logo.png index a0d9e340..1e51bfe2 100644 Binary files a/qtjava/javalib/examples/widgets/tt-logo.png and b/qtjava/javalib/examples/widgets/tt-logo.png differ -- cgit v1.2.1