File: newwidget.cpp

package info (click to toggle)
kppp 4:17.08.3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 4,176 kB
  • sloc: cpp: 13,825; tcl: 49; sh: 19; xml: 15; makefile: 5
file content (17 lines) | stat: -rw-r--r-- 493 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/////////////////////////////////////////////////////////////////////////////
//
// functions generating layout-aware widgets
//
/////////////////////////////////////////////////////////////////////////////

#include "newwidget.h"

QLineEdit *newLineEdit(int visiblewidth, QWidget *parent) {
  QLineEdit *l = new QLineEdit(parent);
  if(visiblewidth == 0)
    l->setMinimumWidth(l->sizeHint().width());
  else
    l->setFixedWidth(l->fontMetrics().width('H') * visiblewidth);
  
  return l;
}