Changeset 4 in tspsg-svn for trunk/src


Ignore:
Timestamp:
Oct 14, 2007, 5:26:42 AM (17 years ago)
Author:
laleppa
Message:

Converted source files to UTF-8
Some code changes :-)

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/main.cpp

    • Property svn:keywords set to Id URL
    r2 r4  
    11/*
    22 *      TSPSG - TSP Solver and Generator
    3  *      Copyright (C) 2007 L¸ppa <lacontacts[at]gmail[dot]com>
     3 *      Copyright (C) 2007 Lёppa <lacontacts[at]gmail[dot]com>
     4 *
     5 *      $Id$
     6 *      $URL$
    47 *
    58 *      This file is part of TSPSG.
  • trunk/src/mainwindow.cpp

    • Property svn:keywords set to Id URL
    r2 r4  
    11/*
    22 *      TSPSG - TSP Solver and Generator
    3  *      Copyright (C) 2007 L¸ppa <lacontacts[at]gmail[dot]com>
     3 *      Copyright (C) 2007 Lёppa <lacontacts[at]gmail[dot]com>
     4 *
     5 *      $Id$
     6 *      $URL$
    47 *
    58 *      This file is part of TSPSG.
     
    2932        setupUi(this);
    3033        connect(actionSettingsSettings,SIGNAL(triggered()),this,SLOT(ChangeSettings()));
     34        connect(spinCities,SIGNAL(valueChanged(int)),this,SLOT(CitiesNumberChanged(int)));
    3135        // Centering MainWindow
    3236        // TODO: Loading of saved window state
     
    3438    rect.moveCenter(QApplication::desktop()->screenGeometry(QApplication::desktop()->primaryScreen()).center());
    3539        setGeometry(rect);
     40        for (int k = 0; k < tableTask->rowCount(); k++) {
     41                QTableWidgetItem *item = new QTableWidgetItem(trUtf8("Город ")+QVariant(k + 1).toString());
     42                tableTask->setVerticalHeaderItem(k,item);
     43        }
     44        for (int k = 0; k < tableTask->columnCount(); k++) {
     45                QTableWidgetItem *item = new QTableWidgetItem(trUtf8("Город ")+QVariant(k + 1).toString());
     46                tableTask->setHorizontalHeaderItem(k,item);
     47        }
     48        tableTask->resizeRowsToContents();
     49        tableTask->resizeColumnsToContents();
     50}
    3651
     52void MainWindow::CitiesNumberChanged(int n)
     53{
     54        // Adding row, setting header and adjusting its size
     55bool increased = tableTask->rowCount() < n ? true : false;
     56        tableTask->setRowCount(n);
     57QTableWidgetItem *item = new QTableWidgetItem(trUtf8("Город ")+QVariant(n).toString());
     58        tableTask->setVerticalHeaderItem(n - 1,item);
     59        if (increased)
     60                tableTask->resizeRowToContents(n - 1);
     61        // Adding column, setting header and adjusting its size
     62        increased = tableTask->columnCount() < n ? true : false;
     63        tableTask->setColumnCount(n);
     64        item = new QTableWidgetItem(trUtf8("Город ")+QVariant(n).toString());
     65        tableTask->setHorizontalHeaderItem(n - 1,item);
     66        if (increased)
     67        tableTask->resizeColumnToContents(n - 1);
     68        tableTask->setMinimumSize(tableTask->sizeHint());
    3769}
    3870
  • trunk/src/mainwindow.h

    • Property svn:keywords set to Id URL
    r1 r4  
    11/*
    22 *      TSPSG - TSP Solver and Generator
    3  *      Copyright (C) 2007 L¸ppa <lacontacts[at]gmail[dot]com>
     3 *      Copyright (C) 2007 Lёppa <lacontacts[at]gmail[dot]com>
     4 *
     5 *      $Id$
     6 *      $URL$
    47 *
    58 *      This file is part of TSPSG.
     
    3336private slots:
    3437        void ChangeSettings();
     38        void CitiesNumberChanged(int n);
    3539};
    3640
  • trunk/src/settingsdialog.cpp

    r3 r4  
    11/*
    22 *      TSPSG - TSP Solver and Generator
    3  *      Copyright (C) 2007 L¸ppa <lacontacts[at]gmail[dot]com>
     3 *      Copyright (C) 2007 Lёppa <lacontacts[at]gmail[dot]com>
    44 *
    55 *      $Id$
  • trunk/src/settingsdialog.h

    r3 r4  
    11/*
    22 *      TSPSG - TSP Solver and Generator
    3  *      Copyright (C) 2007 L¸ppa <lacontacts[at]gmail[dot]com>
     3 *      Copyright (C) 2007 Lёppa <lacontacts[at]gmail[dot]com>
    44 *
    55 *      $Id$
Note: See TracChangeset for help on using the changeset viewer.