Esempio n. 1
0
//! [0] //! [1]
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QSplitter *splitter = new QSplitter;

//! [2] //! [3]
    QFileSystemModel *model = new QFileSystemModel;
    model->setRootPath(QDir::currentPath());
//! [0] //! [2] //! [4] //! [5]
    QTreeView *tree = new QTreeView(splitter);
//! [3] //! [6]
    tree->setModel(model);
//! [4] //! [6] //! [7]
    tree->setRootIndex(model->index(QDir::currentPath()));
//! [7]

    QListView *list = new QListView(splitter);
    list->setModel(model);
    list->setRootIndex(model->index(QDir::currentPath()));

//! [5]
    QItemSelectionModel *selection = new QItemSelectionModel(model);
    tree->setSelectionModel(selection);
    list->setSelectionModel(selection);

//! [8]
    splitter->setWindowTitle("Two views onto the same file system model");
    splitter->show();
    return app.exec();
}
Esempio n. 2
0
void MainWindow::prepareProjectListView()
{
    QListView *view = ui->centralWidget->findChild<QListView*>("projectLst");
    QStandardItemModel *model = new QStandardItemModel;
    view->setItemDelegate(new ProjectItemDelegate);
    view->setModel(model);
}
Esempio n. 3
0
void tst_QItemDelegate::editorKeyPress()
{
    QFETCH(QString, initial);
    QFETCH(QString, expected);

    QStandardItemModel model;
    model.appendRow(new QStandardItem(initial));

    QListView view;
    view.setModel(&model);
    view.show();

    QModelIndex index = model.index(0, 0);
    view.setCurrentIndex(index); // the editor will only selectAll on the current index
    view.edit(index);

    QList<QLineEdit*> lineEditors = qFindChildren<QLineEdit *>(view.viewport());
    QCOMPARE(lineEditors.count(), 1);

    QLineEdit *editor = lineEditors.at(0);
    QCOMPARE(editor->selectedText(), initial);

    QTest::keyClicks(editor, expected);
    QTest::keyClick(editor, Qt::Key_Enter);
    QApplication::processEvents();

    QCOMPARE(index.data().toString(), expected);
}
Esempio n. 4
0
Window::Window(QWidget *parent)
    : QWidget(parent)
{
    FileListModel *model = new FileListModel(this);

    model->init();

    QLabel *label = new QLabel(tr("&Directory:"));
    QLineEdit *lineEdit = new QLineEdit;
    label->setBuddy(lineEdit);

    QListView *view = new QListView;
    view->setModel(model);
    view->setUniformItemSizes(true);

    connect(lineEdit, SIGNAL(textChanged(QString)), model, SLOT(setDirPath(QString)));
    connect(lineEdit, SIGNAL(editingFinished()), model, SLOT(list()));


    /*
	here: connect the signal of special io thread entry added to the slot entryadded of filelistmodel
    */

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(label, 0, 0);
    layout->addWidget(lineEdit, 0, 1);
    layout->addWidget(view, 1, 0, 1, 2);

    setLayout(layout);
    setWindowTitle(tr("Fetch More Example"));

}
Esempio n. 5
0
void MainWindow::buildFileBrowser()
{
    QString rootPath = qgetenv("HOME");
    this->drivesModel->setFilter(QDir::NoDotAndDotDot | QDir::Dirs);

    QTreeView *treeView = this->treeView = new QTreeView(this->ui->dockDir);
    treeView->setModel(this->drivesModel);
    treeView->setRootIndex(this->drivesModel->setRootPath(rootPath + "/../"));
    treeView->hideColumn(1);
    treeView->hideColumn(2);
    treeView->hideColumn(3);
    treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    treeView->setDragEnabled(true);
    treeView->setDragDropMode(QAbstractItemView::DragOnly);
    this->ui->dockDir->setWidget(treeView);

    this->filesModel->setFilter(QDir::NoDotAndDotDot | QDir::Files);
    QListView *listView = this->listView = new QListView(this->ui->dockFile);
    listView->setModel(this->filesModel);
    listView->setRootIndex(this->filesModel->setRootPath(rootPath));
    listView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    listView->setDragEnabled(true);
    listView->setSelectionMode(QAbstractItemView::ExtendedSelection);
    this->ui->dockFile->setWidget(listView);

    listView->show();
    treeView->show();
}
Esempio n. 6
0
void tst_QItemDelegate::doubleEditorNegativeInput()
{
    QStandardItemModel model;

    QStandardItem *item = new QStandardItem;
    item->setData(10.0, Qt::DisplayRole);
    model.appendRow(item);

    QListView view;
    view.setModel(&model);
    view.show();

    QModelIndex index = model.index(0, 0);
    view.setCurrentIndex(index); // the editor will only selectAll on the current index
    view.edit(index);

    QList<QDoubleSpinBox*> editors = qFindChildren<QDoubleSpinBox *>(view.viewport());
    QCOMPARE(editors.count(), 1);

    QDoubleSpinBox *editor = editors.at(0);
    QCOMPARE(editor->value(), double(10));

    QTest::keyClick(editor, Qt::Key_Minus);
    QTest::keyClick(editor, Qt::Key_1);
    QTest::keyClick(editor, Qt::Key_0);
    QTest::keyClick(editor, Qt::Key_Comma); //support both , and . locales
    QTest::keyClick(editor, Qt::Key_Period);
    QTest::keyClick(editor, Qt::Key_0);
    QTest::keyClick(editor, Qt::Key_Enter);
    QApplication::processEvents();

    QCOMPARE(index.data().toString(), QString("-10"));
}
PrivateChatDialog::PrivateChatDialog(QWidget * parent)
    : QDialog(parent)
{
    m_name_w = new QLineEdit;

    m_owner_w = new QLineEdit;
    m_owner_w->setReadOnly(true);

    QListView * listView = new QListView;
    listView->setModel(&m_model);

    QFormLayout * formLayout = new QFormLayout;
    formLayout->addRow(tr("&Name : "), m_name_w);
    formLayout->addRow(tr("&Owner : "), m_owner_w);
    formLayout->addRow(tr("&Player : "), listView);

    m_buttonBox = new QDialogButtonBox;
    connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    QVBoxLayout * mainLayout = new QVBoxLayout;
    mainLayout->addLayout(formLayout);
    mainLayout->addWidget(m_buttonBox);

    setLayout(mainLayout);

    setSizeGripEnabled(true);
}
Esempio n. 8
0
File: main.cpp Progetto: cedrus/qt4
//! [0]
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

// Unindented for quoting purposes:
//! [1]
QStringList numbers;
numbers << "One" << "Two" << "Three" << "Four" << "Five";

QAbstractItemModel *model = new StringListModel(numbers);
//! [0] //! [1] //! [2] //! [3]
QListView *view = new QListView;
//! [2]
view->setWindowTitle("View onto a string list model");
//! [4]
view->setModel(model);
//! [3] //! [4]

    model->insertRows(5, 7, QModelIndex());

    for (int row = 5; row < 12; ++row) {
        QModelIndex index = model->index(row, 0, QModelIndex());
        model->setData(index, QString::number(row+1));
    }

//! [5]
    view->show();
    return app.exec();
}
Esempio n. 9
0
Window::Window(QWidget *parent)
    : QWidget(parent)
{
    FileListModel *model = new FileListModel(this);
    model->setDirPath(QLibraryInfo::location(QLibraryInfo::PrefixPath));

    QLabel *label = new QLabel(tr("&Directory:"));
    QLineEdit *lineEdit = new QLineEdit;
    label->setBuddy(lineEdit);

    QListView *view = new QListView;
    view->setModel(model);

    logViewer = new QTextBrowser;
    logViewer->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));

    connect(lineEdit, SIGNAL(textChanged(QString)),
            model, SLOT(setDirPath(QString)));
    connect(lineEdit, SIGNAL(textChanged(QString)),
            logViewer, SLOT(clear()));
    connect(model, SIGNAL(numberPopulated(int)),
            this, SLOT(updateLog(int)));
    
    QGridLayout *layout = new QGridLayout;
    layout->addWidget(label, 0, 0);
    layout->addWidget(lineEdit, 0, 1);
    layout->addWidget(view, 1, 0, 1, 2);
    layout->addWidget(logViewer, 2, 0, 1, 2);

    setLayout(layout);
    setWindowTitle(tr("Fetch More Example"));
}
Esempio n. 10
0
int main( int argc, char* argv[] )
{
  QApplication app( argc, argv );

  // Open the addressbook file in the working directory 
  QFile file("addressbook.csv");
  if ( !file.open(QIODevice::ReadOnly|QIODevice::Text) )
	  return 1;

  // Read its content into a string
  QString addresses = QString::fromUtf8(file.readAll());
  AddressbookModel model(addresses);

  QListView listView;
  listView.setModel(&model);
  listView.setModelColumn(0);
  listView.show();

  QTreeView treeView;
  treeView.setModel(&model);
  treeView.show();

  QTableView tableView;
  tableView.setModel(&model);
  tableView.show();

  return app.exec();
}
Esempio n. 11
0
void tst_QItemDelegate::task257859_finalizeEdit()
{
    QStandardItemModel model;
    model.appendRow(new QStandardItem());

    QListView view;
    view.setModel(&model);
    view.show();
    QApplication::setActiveWindow(&view);
    view.setFocus();
    QTest::qWait(30);

    QModelIndex index = model.index(0, 0);
    view.edit(index);
    QTest::qWait(30);

    QList<QLineEdit *> lineEditors = qFindChildren<QLineEdit *>(view.viewport());
    QCOMPARE(lineEditors.count(), 1);

    QPointer<QWidget> editor = lineEditors.at(0);
    QCOMPARE(editor->hasFocus(), true);

    QDialog dialog;
    QTimer::singleShot(500, &dialog, SLOT(close()));
    dialog.exec();
    QTRY_VERIFY(!editor);
}
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QObject *parent = &app;

    QStringList numbers;
    numbers << "One" << "Two" << "Three" << "Four" << "Five";

    QAbstractItemModel *stringListModel = new QStringListModel(numbers, parent);

//! [0]
    QSortFilterProxyModel *filterModel = new QSortFilterProxyModel(parent);
    filterModel->setSourceModel(stringListModel);
//! [0]

    QWidget *window = new QWidget;

//! [1]
    QListView *filteredView = new QListView;
    filteredView->setModel(filterModel);
//! [1]
    filteredView->setWindowTitle("Filtered view onto a string list model");

    QLineEdit *patternEditor = new QLineEdit;
    QObject::
    connect(patternEditor, SIGNAL(textChanged(const QString &)),
            filterModel, SLOT(setFilterRegExp(const QString &)));

    QVBoxLayout *layout = new QVBoxLayout(window);
    layout->addWidget(filteredView);
    layout->addWidget(patternEditor);

    window->show();
    return app.exec();
}
Esempio n. 13
0
void tst_QItemDelegate::uintEdit()
{
    QListView view;
    QStandardItemModel model;

    {
        QStandardItem *data=new QStandardItem;
        data->setEditable(true);
        data->setData(QVariant((uint)1), Qt::DisplayRole);
        model.setItem(0, 0, data);
    }
    {
        QStandardItem *data=new QStandardItem;
        data->setEditable(true);
        data->setData(QVariant((uint)1), Qt::DisplayRole);
        model.setItem(1, 0, data);
    }

    view.setModel(&model);
    view.setEditTriggers(QAbstractItemView::AllEditTriggers);

    const QModelIndex firstCell = model.index(0, 0);

    QCOMPARE(firstCell.data(Qt::DisplayRole).userType(), static_cast<int>(QMetaType::UInt));

    view.selectionModel()->setCurrentIndex(model.index(0, 0), QItemSelectionModel::Select);
    view.edit(firstCell);

    QSpinBox *sb = view.findChild<QSpinBox*>();
    QVERIFY(sb);

    sb->stepUp();

    // Select another index to trigger the end of editing.
    const QModelIndex secondCell = model.index(1, 0);
    view.selectionModel()->setCurrentIndex(secondCell, QItemSelectionModel::Select);

    QCOMPARE(firstCell.data(Qt::DisplayRole).userType(), static_cast<int>(QMetaType::UInt));
    QCOMPARE(firstCell.data(Qt::DisplayRole).toUInt(), static_cast<uint>(2));


    view.edit(secondCell);

    // The first spinbox is deleted with deleteLater, so it is still there.
    QList<QSpinBox*> sbList = view.findChildren<QSpinBox*>();
    QCOMPARE(sbList.size(), 2);

    sb = sbList.at(1);

    sb->stepDown(); // 1 -> 0
    sb->stepDown(); // 0 (no effect)
    sb->stepDown(); // 0 (no effect)

    // Select another index to trigger the end of editing.
    view.selectionModel()->setCurrentIndex(firstCell, QItemSelectionModel::Select);

    QCOMPARE(secondCell.data(Qt::DisplayRole).userType(), static_cast<int>(QMetaType::UInt));
    QCOMPARE(secondCell.data(Qt::DisplayRole).toUInt(), static_cast<uint>(0));
}
Esempio n. 14
0
void ComboBox::hack()
{
	QListView *v = new QListView( this );
	v->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
	v->setMinimumHeight( 50 );
	v->setModel( model() );
	setView( v );
}
Esempio n. 15
0
void Rozmowa::reject()
{
    QListView* rozmowa = this->findChild<QListView*>("rozmowa");
    model->messages[index].clear();
    QStringList list= model->messages[index];
    rozmowa->setModel(new QStringListModel(list));
    message->clear();
    QDialog::reject();
}
Esempio n. 16
0
/*!
  Sets \a model to be the ThemeListModel associated with this ThemeListItem.
  If this item currently has a QListView widget set, this model is installed
  immediately on the view using QListView::setModel().
  If a call is made to QWidget::setWidget() in the future, this model
  will be installed in the same way.
*/
void QThemeListItem::setModel(QThemeListModel *model)
{
    if (d->model != model) {
        d->model = model;
        QListView* view = listView();
        if (view != 0 && view->model() != d->model)
            view->setModel(d->model);
    }
}
Esempio n. 17
0
QgsWelcomePage::QgsWelcomePage( QWidget* parent )
    : QTabWidget( parent )
{
  QVBoxLayout* mainLayout = new QVBoxLayout;
  mainLayout->setMargin( 0 );
  setLayout( mainLayout );

  QHBoxLayout* layout = new QHBoxLayout();
  layout->setMargin( 9 );

  mainLayout->addLayout( layout );

  QWidget* recentProjctsContainer = new QWidget;
  recentProjctsContainer->setLayout( new QVBoxLayout );
  QLabel* recentProjectsTitle = new QLabel( QString( "<h1>%1</h1>" ).arg( tr( "Recent Projects" ) ) );
  recentProjctsContainer->layout()->addWidget( recentProjectsTitle );

  QListView* recentProjectsListView = new QListView();
  mModel = new QgsWelcomePageItemsModel( recentProjectsListView );
  recentProjectsListView->setModel( mModel );
  recentProjectsListView->setItemDelegate( new QgsWelcomePageItemDelegate( recentProjectsListView ) );

  recentProjctsContainer->layout()->addWidget( recentProjectsListView );

  addTab( recentProjctsContainer, "Recent Projects" );

  QWidget* whatsNewContainer = new QWidget;
  whatsNewContainer->setLayout( new QVBoxLayout );
  QLabel* whatsNewTitle = new QLabel( QString( "<h1>%1</h1>" ).arg( tr( "QGIS News" ) ) );
  whatsNewContainer->layout()->addWidget( whatsNewTitle );

  QgsWebView* whatsNewPage = new QgsWebView();
  whatsNewPage->setUrl( QUrl::fromLocalFile( QgsApplication::whatsNewFilePath() ) );
  whatsNewPage->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
  whatsNewPage->setContextMenuPolicy( Qt::NoContextMenu );
  whatsNewPage->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
  whatsNewPage->setStyleSheet( "background:transparent" );
  whatsNewPage->setAttribute( Qt::WA_TranslucentBackground );

  whatsNewContainer->layout()->addWidget( whatsNewPage );
//  whatsNewContainer->setMaximumWidth( 250 );
//  whatsNewContainer->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
  addTab( whatsNewContainer, "News" );

  connect( whatsNewPage, SIGNAL( linkClicked( QUrl ) ), this, SLOT( whatsNewLinkClicked( QUrl ) ) );

  mVersionInformation = new QLabel;
  mainLayout->addWidget( mVersionInformation );
  mVersionInformation->setVisible( false );

  mVersionInfo = new QgsVersionInfo();
  connect( mVersionInfo, SIGNAL( versionInfoAvailable() ), this, SLOT( versionInfoReceived() ) );
  mVersionInfo->checkVersion();

  connect( recentProjectsListView, SIGNAL( activated( QModelIndex ) ), this, SLOT( itemActivated( QModelIndex ) ) );
}
Esempio n. 18
0
int main( int argc, char **argv )
{
    QApplication app( argc, argv );

    QTreeView *tree = new QTreeView();
    QListView *list = new QListView();
    QTableView *table = new QTableView();

    QSplitter splitter;
    splitter.addWidget(tree);
    splitter.addWidget(list);
    splitter.addWidget(table);

    QStandardItemModel model( 5, 2 );

    for( int r=0; r<5; r++ )
    {
        for( int c=0; c<2; c++)
        {
            QStandardItem *item = new QStandardItem(QString("Row:%0, Column:%1").arg(r).arg(c));

            if(c == 0)
            {
                for(int i=0; i<3; i++)
                {
                    QStandardItem *child = new QStandardItem(QString("Item %0").arg(i));
                    child->setEditable(false);
                    item->appendRow(child);
                }
            }

            model.setItem(r, c, item);
        }
    }

    model.setHorizontalHeaderItem(0, new QStandardItem("Foo"));
    model.setHorizontalHeaderItem(1, new QStandardItem("Bar-Baz"));

    tree->setModel(&model);
    list->setModel(&model);
    table->setModel(&model);

    list->setSelectionModel(tree->selectionModel());
    table->setSelectionModel(tree->selectionModel());

    table->setSelectionBehavior(QAbstractItemView::SelectRows);
    table->setSelectionMode(QAbstractItemView::SingleSelection);

    splitter.show();

    MainWindow w;
    w.show();

    return app.exec();
}
Esempio n. 19
0
/*!
  \reimp
  Sets the QListView \a w as this ThemeListItem's widget.
  \a w must be non-zero and inherit QListView, otherwise this function will abort.
  An internal implementation of QItemDelegate is installed on the view to handle
  communication between itself and a ThemeListModel.
  If a ThemeListModel object has already been set using setModel(), it is installed immediately
  using QListView::setModel(). If a call is made to setModel() in the future, that model
  will be installed on this widget in the same way.
*/
void QThemeListItem::setWidget(QWidget *w)
{
    QThemeWidgetItem::setWidget(w);
    Q_ASSERT(widget() == 0 || widget()->inherits("QListView") == true);
    if (!widget())
        return;
    QListView* v = listView();
    v->setItemDelegate(new QThemeListDelegate(v, themedScene()->themedView(), themedScene()->themedView()));
    if (d->model != 0 && v->model() != d->model)
        v->setModel(d->model);
}
Esempio n. 20
0
int main(int c, char **v)
{
    QApplication a(c, v);

    QListView view;
    view.setUniformItemSizes(true);
    view.setModel(new RandomListModel(&view));
    view.show();

    return a.exec();
}
Esempio n. 21
0
MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent),ui(new Ui::MainWindow){
    ui->setupUi(this);
    setWindowIcon(QIcon("/Users/nick102795/Desktop/favicon.ico"));
    // build all initial backend structures & load the appropriate data from files
    setInitialState();
    // Set Up the top 8 Most Popular Playlists
    QListView *listView = ui->mostPopularPlaylistListView;
    QAbstractItemModel *model = buildModel();   // make the buildModel() func to intake the new most-popular PL strings
    listView->setModel(model);
    listView->show();
}
int main( int argc, char **argv )
{
    QApplication app( argc, argv );

    IntModel model( 25 );

    QListView list;
    list.setModel( &model );
    list.show();

    return app.exec();
}
Esempio n. 23
0
void MainWindow::createDockingWidgets()
{
    QDockWidget* geometryDockWidget = new QDockWidget(tr("Geometry"), this);
    geometryDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);

    QListView* geometryListView = new QListView(this);
    m_geometryListUiModel = new GeometryListUiModel(this);
    geometryListView->setModel(m_geometryListUiModel);

    geometryDockWidget->setWidget(geometryListView);
    this->addDockWidget(Qt::RightDockWidgetArea, geometryDockWidget);
}
Esempio n. 24
0
CriteriaChooser::CriteriaChooser( CriteriaModel *model )
  : m_model( model )
{
  QBoxLayout *topLayout = new QVBoxLayout( this );

  QListView *listView = new QListView;
  topLayout->addWidget( listView );
  
  listView->setModel( m_model );

  connect( listView, SIGNAL( clicked( const QModelIndex & ) ),
    SLOT( chooseItem( const QModelIndex & ) ) );
}
Esempio n. 25
0
QT_BEGIN_NAMESPACE


ErrorsView::ErrorsView(QWidget *parent) :
    QWidget(parent)
{
    m_list = new QStandardItemModel(this);
    QListView *listView = new QListView(this);
    listView->setModel(m_list);
    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->setMargin(0);
    layout->addWidget(listView);
}
Esempio n. 26
0
int main(int argc, char* argv[])
{
  QApplication app(argc, argv);
  QStringListModel model;
  QStringList toBuy;
  toBuy << "butter" << "milk" 
       << "cherries" << "bananas";
  model.setStringList(toBuy);
  QListView view;
  view.setModel(&model);
  view.show();
  return app.exec();
}
Esempio n. 27
0
void MainWindow::updateListView(QList<Body> bodyList)
{
    std::cout << "update list view " << std::endl;
    objectListSource = new QStringListModel;
    //objectList->setModel(objectListSource );
    objectListSource->insertColumns(0,1);
    objectListSource->insertRows(0,bodyList.size());
    for(int i(0);i<bodyList.size();i++)
    {
        objectListSource->setData(objectListSource->index(i),bodyList[i].getName());
    }
    QListView * objectList = findChild<QListView*>(QString("objectList"));
    objectList->setModel(objectListSource);
}
Esempio n. 28
0
	void ItemHandlerListView::SetDataSource (const QString& prop, QAbstractItemModel *model)
	{
		QListView *list = Propname2Listview_ [prop];
		if (!list)
		{
			qWarning () << Q_FUNC_INFO
					<< "listview for property"
					<< prop
					<< "not found";
			return;
		}

		list->setModel (model);
	}
Esempio n. 29
0
TChatWindow::TChatWindow(const QString& frndLogin)
    : FriendLogin(frndLogin)
{
    this->setGeometry(QDesktopWidget().availableGeometry().center().x() - (CHAT_WINDOW_WIDTH / 2),
                      QDesktopWidget().availableGeometry().center().y() - (CHAT_WINDOW_HEIGHT / 2),
                       CHAT_WINDOW_WIDTH, CHAT_WINDOW_HEIGHT);
    this->setWindowTitle(frndLogin);

    MessagesModel.setStringList(Messages);

    QVBoxLayout* currentLayout = new QVBoxLayout(this);

    CallStatusLabel = new QLabel(this);
    CallStatusLabel->setStyleSheet("QLabel { font-size: 12px; font: bold; }");
    currentLayout->addWidget(CallStatusLabel.data());
    CallStatusLabel->hide();

    CallButton = new QPushButton(this);
    currentLayout->addWidget(CallButton.data());
    connect(CallButton.data(), &QPushButton::clicked, this, &TChatWindow::OnCallClicked);

    DeclineButton = new QPushButton(this);
    currentLayout->addWidget(DeclineButton.data());
    connect(DeclineButton.data(), &QPushButton::clicked, [this] () {
        CallStatus = NVocal::CAS_NotCalling;
        UpdateCallStatus();
        emit OnFinishCall(FriendLogin);
    });

    UpdateCallStatus();

    QListView* messagesListView = new QListView();
    messagesListView->setModel(&MessagesModel);
    currentLayout->addWidget(messagesListView);
    MessageEdit = new TChatMessageEdit();
    connect(MessageEdit.data(), &TChatMessageEdit::SendMessage, this, &TChatWindow::OnSendMessage);

    MessageEdit->setFixedHeight(CHAT_MESSAGE_HEIGHT);
    currentLayout->addWidget(MessageEdit);

    RingSound = new QSound(":/sounds/ring.wav");
    RingSound->setLoops(-1);

    CallSound = new QSound(":/sounds/call.wav");
    CallSound->setLoops(-1);

    this->show();
}
Esempio n. 30
0
void Window::exempleDirModel()
{
    QVBoxLayout* layout = new QVBoxLayout;

    QDirModel* modele = new QDirModel;
    QTreeView* treeView = new QTreeView;
    QListView* listView = new QListView;

    treeView->setModel(modele);
    listView->setModel(modele);

    treeView->setRootIndex(modele->index("C:/MinGW"));
    listView->setRootIndex(modele->index("C:"));
    layout->addWidget(treeView);

    setCentralWidget(treeView);
}