Add ``setValidator`` method to widget instances that receive input

Aperta
#982 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript, node.js
Ambito
desktop

Direzione di ricerca

Start by reading the existing QLineEdit and setInputMask APIs to understand how input-related methods are exposed in NodeGui. Define the setValidator behavior for widgets that accept input, including how the supplied function is evaluated, and verify the resulting API with a representative QLineEdit example.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

It'd be great if widgets that accept user input like QLineEdit instances implemented a setValidator method that accepted a function that prohibits input for which it evaluates to false.

For an example of how this is done in PyQt see here.

In JavaScript nodegui it could look something like this:

const { isFloat } = require("validator"); // i.e. validator from npm

//...

const widthLineEdit = new QLineEdit();
widthLineEdit.setPlaceholderText("0.0");
widthLineEdit.setValidator(isFloat)

//...

In the meantime I'm open to workaround suggestions (setInputMask, etc.), I've only just started playing around with nodegui, but so far I'm liking it. Please keep it going. Thank you!

Lingua principale
C++
Stelle
9.2k
Fork
315
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nodegui/nodegui

Tutte le issue di nodegui/nodegui

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.