You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Friday, September 24th 2004, 9:12pm

KMainWindow size?

I have a project (knetworkled), and I setup the windows and widgets in a pretty hurky, nasty way. Here, I'll show you the first few lines from my configuration window:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
KLedConfigWindow::KLedConfigWindow()
 : KMainWindow()
{
    /* set up the little window icon (top left) */
    QPixmap winIcon = QPixmap( kledconfigwindow_xpm );
    KWin::setIcons(this->winId(), winIcon, winIcon);
    
    this->setCaption( QString("KNetworkLED Configuration") );
    
    this->setFixedSize( 230, 180 );
    
    this->m_lblDeviceTextLabel = new QLabel( (QWidget *)this, "devicelabel", 0);
    this->m_lblDeviceTextLabel->move( QPoint(10, 40));
    this->m_lblDeviceTextLabel->setFixedSize( 80, 20 );
    this->m_lblDeviceTextLabel->setText(QString("Device:"));
    
    this->m_lblPollRateTextLabel = new QLabel(  (QWidget *)this, "pollratelabel", 0);
    this->m_lblPollRateTextLabel->move( QPoint(10, 80));
    this->m_lblPollRateTextLabel->setFixedSize( 80, 20 );
    this->m_lblPollRateTextLabel->setText(QString("Poll Rate:"));
    (...)
    


Yeah, I know, it's ugly, but it makes sense to me and it works. Well most of it. After I installed KDE-3.3, I noticed my buttons along the bottom of the windows were now cut off by the bottom of the window (as in the were mostly below the windows with just the tops of them poking out the bottom). I figured something changed, like setFixedSize() now includes the title bar of the window or something.

Well, I went to change this->setFixedSize() (which is inhereted from QWidget if memory serves) to something larger to stop the buttons from getting cut off, but the window size won't change. I can COMPLETELY COMMENT OUT that line and the window size WILL STILL BE 230 by 180! I thought maybe the "moc" files were storing the size, but after multiple "make clean"'s and "make distclean"'s and verifiying that the moc's were gone, IT'S STILL HAPPENING!!!

Any ideas?

This post has been edited 1 times, last edit by "glitch13" (Sep 24th 2004, 9:15pm)


anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

2

Saturday, September 25th 2004, 6:25pm

Better use a layout.
It is just a little more effort at first but spares you from problems later on.
Especially when changing text of elements (which will happen at runtime if you follow the recommendations to put text into i18n() commands to have them translatable)

Cheers,
_
Qt/KDE Developer
Debian User