From a7ce3d715138fffe0817855468a38f6ca46b7c60 Mon Sep 17 00:00:00 2001 From: senator Date: Thu, 11 Oct 2007 07:49:03 +0000 Subject: Updated all widgets with better width height control --- client/widgets/checkbox.cc | 6 ++-- client/widgets/combobox.cc | 6 ++-- client/widgets/frame.cc | 18 ------------ client/widgets/groupbox.cc | 67 ++++++++++++++++++++++++++++++++++++++++++ client/widgets/groupbox.h | 45 ++++++++++++++++++++++++++++ client/widgets/label.cc | 5 ++-- client/widgets/lineedit.cc | 6 ++-- client/widgets/listbox.cc | 6 ++-- client/widgets/pushbutton.cc | 6 ++-- client/widgets/radiobuttons.cc | 6 ++-- client/widgets/textedit.cc | 6 ++-- 11 files changed, 143 insertions(+), 34 deletions(-) create mode 100644 client/widgets/groupbox.cc create mode 100644 client/widgets/groupbox.h (limited to 'client/widgets') diff --git a/client/widgets/checkbox.cc b/client/widgets/checkbox.cc index 3c73235..7d261e9 100644 --- a/client/widgets/checkbox.cc +++ b/client/widgets/checkbox.cc @@ -32,11 +32,13 @@ CheckBox::CheckBox(QDomNode node) QDomElement elem = node.toElement(); if(elem.hasAttribute("width")) { - resize(elem.attribute("width").toInt(), height()); + //resize(elem.attribute("width").toInt(), height()); + setMinimumWidth(elem.attribute("width").toInt()); } if(elem.hasAttribute("height")) { - resize(width(), elem.attribute("height").toInt()); + //resize(width(), elem.attribute("height").toInt()); + setMinimumHeight(elem.attribute("height").toInt()); } if(elem.hasAttribute("caption")) { diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc index 22efc96..e60ea8e 100644 --- a/client/widgets/combobox.cc +++ b/client/widgets/combobox.cc @@ -33,11 +33,13 @@ ComboBox::ComboBox(QDomNode node) QDomElement elem = node.toElement(); if(elem.hasAttribute("width")) { - resize(elem.attribute("width").toInt(), height()); + //resize(elem.attribute("width").toInt(), height()); + setMinimumWidth(elem.attribute("width").toInt()); } if(elem.hasAttribute("height")) { - resize(width(), elem.attribute("height").toInt()); + //resize(width(), elem.attribute("height").toInt()); + setMinimumHeight(elem.attribute("height").toInt()); } QDomNodeList children = node.childNodes(); diff --git a/client/widgets/frame.cc b/client/widgets/frame.cc index bc72a2a..0edf1fa 100644 --- a/client/widgets/frame.cc +++ b/client/widgets/frame.cc @@ -33,24 +33,6 @@ Frame::Frame(QDomNode node) { QDomElement elem = node.toElement(); - /* - if(elem.hasAttribute("caption")) { - setTitle(elem.attribute("caption")); - } else { - setTitle(elem.attribute("")); - } - */ - /* - if(elem.hasAttribute("border")) { - if(elem.attribute("border") == "true") { - setFlat(false); - } else { - setFlat(true); - } - } else { - setFlat(true); - } - */ if(elem.hasAttribute("layout")) { if(elem.attribute("layout") == "hbox") { QHBoxLayout *layout = new QHBoxLayout(); diff --git a/client/widgets/groupbox.cc b/client/widgets/groupbox.cc new file mode 100644 index 0000000..8ac2fc8 --- /dev/null +++ b/client/widgets/groupbox.cc @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/*************************************************************************** + * frame.cc + * + * Wed Jul 18 09:56:37 CEST 2007 + * Copyright 2007 Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup + * deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk + ****************************************************************************/ + +/* + * This file is part of Pracro. + * + * Pracro is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Pracro is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Pracro; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#include "groupbox.h" +#include +#include + +GroupBox::GroupBox(QDomNode node) + : QGroupBox(), Widget(node) +{ + QDomElement elem = node.toElement(); + + if(elem.hasAttribute("caption")) { + setTitle(elem.attribute("caption")); + } else { + setTitle(elem.attribute("")); + } + + /* + if(elem.hasAttribute("border")) { + if(elem.attribute("border") == "true") { + setFlat(false); + } else { + setFlat(true); + } + } else { + setFlat(true); + } + */ + if(elem.hasAttribute("layout")) { + if(elem.attribute("layout") == "hbox") { + QHBoxLayout *layout = new QHBoxLayout(); + setLayout(layout); + } else if (elem.attribute("layout") == "vbox") { + QVBoxLayout *layout = new QVBoxLayout(); + setLayout(layout); + } + } +} + +QString GroupBox::getValue() +{ + return "Frame"; +} diff --git a/client/widgets/groupbox.h b/client/widgets/groupbox.h new file mode 100644 index 0000000..a3349d5 --- /dev/null +++ b/client/widgets/groupbox.h @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/*************************************************************************** + * groupbox.h + * + * Wed Jul 18 09:56:36 CEST 2007 + * Copyright 2007 Bent Bisballe Nyeng, Lars Bisballe Jensen and Peter Skaarup + * deva@aasimon.org, elsenator@gmail.com and piparum@piparum.dk + ****************************************************************************/ + +/* + * This file is part of Pracro. + * + * Pracro is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Pracro is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Pracro; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#ifndef __PRACRO_GROUPBOX_H__ +#define __PRACRO_GROUPBOX_H__ + +#include "widget.h" +#include +#include + +class GroupBox : public QGroupBox, public Widget +{ + +public: + GroupBox(QDomNode node); + +public slots: + QString getValue(); + +}; + +#endif/*__PRACRO_GROUPBOX_H__*/ diff --git a/client/widgets/label.cc b/client/widgets/label.cc index a9a78b4..4bd1aff 100644 --- a/client/widgets/label.cc +++ b/client/widgets/label.cc @@ -38,7 +38,8 @@ Label::Label(QDomNode node) } if(elem.hasAttribute("height")) { - resize(width(), elem.attribute("height").toInt()); + //resize(width(), elem.attribute("height").toInt()); + setMinimumHeight(elem.attribute("height").toInt()); } if(elem.hasAttribute("caption")) { @@ -60,7 +61,7 @@ Label::Label(QDomNode node) setAlignment(Qt::AlignLeft); } - // Always center vertically in the adressed space + // Always center vertically in the addressed space setAlignment(Qt::AlignVCenter); } diff --git a/client/widgets/lineedit.cc b/client/widgets/lineedit.cc index cb53571..c55b15a 100644 --- a/client/widgets/lineedit.cc +++ b/client/widgets/lineedit.cc @@ -33,11 +33,13 @@ LineEdit::LineEdit(QDomNode node) QDomElement elem = node.toElement(); if(elem.hasAttribute("width")) { - resize(elem.attribute("width").toInt(), height()); + //resize(elem.attribute("width").toInt(), height()); + setMinimumWidth(elem.attribute("width").toInt()); } if(elem.hasAttribute("height")) { - resize(width(), elem.attribute("height").toInt()); + //resize(width(), elem.attribute("height").toInt()); + setMinimumHeight(elem.attribute("height").toInt()); } if(elem.hasAttribute("regexp")) { diff --git a/client/widgets/listbox.cc b/client/widgets/listbox.cc index 57de905..9435ac1 100644 --- a/client/widgets/listbox.cc +++ b/client/widgets/listbox.cc @@ -32,11 +32,13 @@ ListBox::ListBox(QDomNode node) QDomElement elem = node.toElement(); if(elem.hasAttribute("width")) { - resize(elem.attribute("width").toInt(), height()); + //resize(elem.attribute("width").toInt(), height()); + setMinimumWidth(elem.attribute("width").toInt()); } if(elem.hasAttribute("height")) { - resize(width(), elem.attribute("height").toInt()); + //resize(width(), elem.attribute("height").toInt()); + setMinimumHeight(elem.attribute("height").toInt()); } QDomNodeList children = node.childNodes(); diff --git a/client/widgets/pushbutton.cc b/client/widgets/pushbutton.cc index 0a01947..1e22190 100644 --- a/client/widgets/pushbutton.cc +++ b/client/widgets/pushbutton.cc @@ -33,11 +33,13 @@ PushButton::PushButton(QDomNode node) QDomElement elem = node.toElement(); if(elem.hasAttribute("width")) { - resize(elem.attribute("width").toInt(), height()); + //resize(elem.attribute("width").toInt(), height()); + setMinimumWidth(elem.attribute("width").toInt()); } if(elem.hasAttribute("height")) { - resize(width(), elem.attribute("height").toInt()); + //resize(width(), elem.attribute("height").toInt()); + setMinimumHeight(elem.attribute("height").toInt()); } if(elem.hasAttribute("caption")) { diff --git a/client/widgets/radiobuttons.cc b/client/widgets/radiobuttons.cc index 47a32f4..dc79831 100644 --- a/client/widgets/radiobuttons.cc +++ b/client/widgets/radiobuttons.cc @@ -46,11 +46,13 @@ RadioButtons::RadioButtons(QDomNode node) } if(elem.hasAttribute("width")) { - resize(elem.attribute("width").toInt(), height()); + //resize(elem.attribute("width").toInt(), height()); + setMinimumWidth(elem.attribute("width").toInt()); } if(elem.hasAttribute("height")) { - resize(width(), elem.attribute("height").toInt()); + //resize(width(), elem.attribute("height").toInt()); + setMinimumHeight(elem.attribute("height").toInt()); } QDomNodeList children = node.childNodes(); diff --git a/client/widgets/textedit.cc b/client/widgets/textedit.cc index 9334d8a..61c5a99 100644 --- a/client/widgets/textedit.cc +++ b/client/widgets/textedit.cc @@ -37,11 +37,13 @@ TextEdit::TextEdit(QDomNode node) QDomElement elem = node.toElement(); if(elem.hasAttribute("width")) { - resize(elem.attribute("width").toInt(), height()); + //resize(elem.attribute("width").toInt(), height()); + setMinimumWidth(elem.attribute("width").toInt()); } if(elem.hasAttribute("height")) { - resize(width(), elem.attribute("height").toInt()); + //resize(width(), elem.attribute("height").toInt()); + setMinimumHeight(elem.attribute("height").toInt()); } if(elem.hasAttribute("regexp")) { -- cgit v1.2.3