C++ (Cpp) SLOT Examples

C++ (Cpp) SLOT - 30 examples found. These are the top rated real world C++ (Cpp) examples of SLOT extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
LocationEditor::LocationEditor(QWidget *parent) :
    QToolButton(parent)
{
    QPalette pal;
    pal.setColor(backgroundRole(), QPalette::Base);
    setPalette(pal);

    this->setFont(global.getGuiFont(font()));

    inactiveColor = "QToolButton {background-color: transparent; border-radius: 0px; border:none; margin 0px; padding: 4px} ";
    this->setCursor(Qt::PointingHandCursor);
    this->setStyleSheet(inactiveColor);

    defaultText = QString(tr("Click to set location..."));
    this->setText(defaultText);
    actionMenu = new QMenu();
    editAction = actionMenu->addAction(tr("Edit..."));
    clearAction = actionMenu->addAction(tr("Clear"));
    viewAction = actionMenu->addAction(tr("View on map"));
    connect(editAction, SIGNAL(triggered()), this, SLOT(buttonClicked()));
    connect(viewAction, SIGNAL(triggered()), this, SLOT(viewClicked()));
    connect(clearAction, SIGNAL(triggered()), this, SLOT(clearClicked()));
    setAutoRaise(false);
    setMenu(actionMenu);
    this->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    this->reloadIcons();
    connect(this, SIGNAL(clicked()), this, SLOT(buttonClicked()));

    hide();
}
Example #2
0
void PathEnterWidget::setup()
{
    mpLineEdit->setAcceptDrops( false );
    connect( mpLineEdit, SIGNAL(textChanged(QString)),
             this, SIGNAL(textChanged(QString)) );
    connect( mpLineEdit, SIGNAL(textEdited(QString)),
             this, SIGNAL(textEdited(QString)) );
    connect( mpLineEdit, SIGNAL(returnPressed()),
             this, SIGNAL(returnPressed()) );

    QPushButton *button = new QPushButton( "...", this );
    button->setMaximumWidth( button->height() );
    connect( button, SIGNAL(clicked()),
             this, SLOT(browse()) );
    connect( mpLineEdit, SIGNAL(returnPressed()),
             this, SLOT(sendFileName()) );

    QCompleter *completer = new QCompleter( this );
    completer->setModel( mpDirModel );
    mpDirModel->setFilter( QDir::AllDirs | QDir::NoDotAndDotDot );
    mpDirModel->setSorting( QDir::Name );
    mpLineEdit->setCompleter( completer );

    QBoxLayout *layout = new QHBoxLayout( this );
    layout->setContentsMargins( 0, 0, 0, 0 );
    layout->addWidget( mpLineEdit );
    layout->addWidget( button );
    setLayout( layout );

    setAcceptDrops( true );
}
Example #3
0
void QgsAttributeTableView::setModel( QgsAttributeTableFilterModel* filterModel )
{
    if ( mFilterModel )
    {
        // Cleanup old model stuff if present
        disconnect( mFilterModel, SIGNAL( filterAboutToBeInvalidated() ), this, SLOT( onFilterAboutToBeInvalidated() ) );
        disconnect( mFilterModel, SIGNAL( filterInvalidated() ), this, SLOT( onFilterInvalidated() ) );
    }

    mFilterModel = filterModel;
    QTableView::setModel( filterModel );

    connect( mFilterModel, SIGNAL( destroyed() ), this, SLOT( modelDeleted() ) );

    delete mFeatureSelectionModel;
    mFeatureSelectionModel = 0;

    if ( filterModel )
    {
        if ( !mFeatureSelectionManager )
        {
            mFeatureSelectionManager = new QgsVectorLayerSelectionManager( mFilterModel->layer(), mFilterModel );
        }

        mFeatureSelectionModel = new QgsFeatureSelectionModel( mFilterModel, mFilterModel, mFeatureSelectionManager, mFilterModel );
        setSelectionModel( mFeatureSelectionModel );
        mTableDelegate->setFeatureSelectionModel( mFeatureSelectionModel );
        connect( mFeatureSelectionModel, SIGNAL( requestRepaint( QModelIndexList ) ), this, SLOT( repaintRequested( QModelIndexList ) ) );
        connect( mFeatureSelectionModel, SIGNAL( requestRepaint() ), this, SLOT( repaintRequested() ) );
    }
}
Example #4
0
CViewer::CViewer()
{
    KPluginFactory *factory=KPluginLoader("kfontviewpart").factory();

    if(factory)
    {
        itsPreview=factory->create<KParts::ReadOnlyPart>(this);

        actionCollection()->addAction(KStandardAction::Open, this, SLOT(fileOpen()));
        actionCollection()->addAction(KStandardAction::Quit, this, SLOT(close()));
        actionCollection()->addAction(KStandardAction::KeyBindings, this, SLOT(configureKeys()));
        itsPrintAct=actionCollection()->addAction(KStandardAction::Print, itsPreview, SLOT(print()));

        itsPrintAct->setEnabled(false);

        if(itsPreview->browserExtension())
            connect(itsPreview->browserExtension(), SIGNAL(enableAction(const char*,bool)),
                    this, SLOT(enableAction(const char*,bool)));

        setCentralWidget(itsPreview->widget());
        createGUI(itsPreview);

        setAutoSaveSettings();
        applyMainWindowSettings(KGlobal::config()->group("MainWindow"));
    }
    else
Example #5
0
TorrentSearch::TorrentSearch()
    : m_bSearching(false)
{
    setupUi(this);
    updateUi();

    connect(pushSearch, SIGNAL(clicked()), this, SLOT(search()));
    connect(treeResults, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(download()));
    connect(pushDownload, SIGNAL(clicked()), this, SLOT(download()));
    connect(treeResults, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(resultsContext(const QPoint&)));

    loadEngines();

    g_settings->beginGroup("torrent/torrent_search");

    foreach(Engine e, m_engines)
    {
        QListWidgetItem* item = new QListWidgetItem(e.name, listEngines);
        bool checked;

        item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);

        checked = g_settings->value(e.name, false).toBool();

        item->setCheckState(checked ? Qt::Checked : Qt::Unchecked);
        listEngines->addItem(item);
    }
Example #6
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    // Get the port we will listen on
    QInputDialog options;
    options.setLabelText("Enter port for listening:");
    options.setTextValue("12349");
    options.exec();

    MainWindow window;
    Server server(options.textValue());
    Client client;

    window.connect(&server, SIGNAL(messageRecieved(QString,QString)),
                   &window, SLOT(displayNewMessage(QString,QString)));

    window.connect(&window, SIGNAL(connectToChanged(QString,QString)),
                   &client, SLOT(connectTo(QString,QString)));

    window.connect(&window, SIGNAL(sendMessage(QString)),
                   &client, SLOT(startTransfer(QString)));

    window.show();
    window.resize(480,320);
    window.setWindowTitle(window.windowTitle() + " (listen port: " + options.textValue() + ")");

    return a.exec();
}