LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-17-2007, 11:44 PM   #1
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Rep: Reputation: 30
Qt3 Can't Set Docable Window to Vertical Orientation


I have the following code.
MainWin.h
Code:
#ifndef MAINWIN_H
#define MAINWIN_H

#include <qmainwindow.h>
#include <qtextedit.h>
#include <qdockwindow.h>

class MainWin: public QMainWindow
{
   
public:
   MainWin();
};

#endif
MainWin.cpp
Code:
#include "MainWin.h"

MainWin::MainWin()
{
//   QTextEdit* editor = new QTextEdit( this );
//   editor->setFocus();
//   setCentralWidget( editor );

   QDockWindow* dw = new QDockWindow;
   dw->setOrientation(Qt::Vertical);
   dw->setResizeEnabled(true);
   dw->setVerticallyStretchable(false);
   dw->setHorizontallyStretchable(true);
   dw->setMovingEnabled(false);
   addDockWindow( dw );
}
main.cpp
Code:
#include <qapplication.h>
#include "MainWin.h"

int main( int argc, char ** argv ) {
    QApplication a( argc, argv );
    MainWin * mw = new MainWin();
    mw->setCaption( "Install Script Maker" );
    mw->show();
    a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
    return a.exec();
}
Yet, the bar still shows up horizontal. How do I make it change its orientation to be vertical? The objective is to split the window in half. So I can have a list box on one half and a text editor on the other half.

Last edited by binarybob0001; 11-17-2007 at 11:52 PM.
 
Old 11-18-2007, 12:59 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Just a guess: have you tried setOrientation() after setResizeEnabled()?
 
Old 11-18-2007, 06:41 PM   #3
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Original Poster
Rep: Reputation: 30
Turns out I needed to use the QSplitter class and set that as my central widget.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Upgrade qt3 -> qt4. Symlinks still point to qt3 alar Linux - Software 1 06-07-2007 09:45 PM
javascript/dhtml set vertical scrolling position in IE j-ray Programming 1 10-12-2006 09:03 AM
X11-set the vertical refresh rate tramni1980 Slackware 14 08-12-2006 07:54 AM
vertical window size majara Linux - Software 4 04-21-2005 04:26 AM
Looking for Orientation Online chidman Linux - Newbie 8 09-11-2004 11:57 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration