Giter VIP home page Giter VIP logo

Comments (10)

a7ul avatar a7ul commented on May 14, 2024 2

Actually yes.
You could add a ref to the react-nodegui component

like so:

const buttonRef = React.createRef<QPushButton>();
useEffect(()=>{
   buttonRef.current.setIconSize(new QSize(23,23));
},[]);
...
...
<Button ref={buttonRef} />

The ref would contain the QPushButton which is the nodegui version of the button component.

Make sure you have the latest version of nodegui to use setIconSize.

from react-nodegui.

a7ul avatar a7ul commented on May 14, 2024 2

iconSize prop is now available in 0.2.7 of react-nodegui for button, checkbox and radiobuttons

from react-nodegui.

a7ul avatar a7ul commented on May 14, 2024 2

Something like this :

import React from "react";
import { Renderer, Button, Window, View } from "@nodegui/react-nodegui";
import { QIcon, QSize } from "@nodegui/nodegui";

const icon = new QIcon(
  "/Users/atulr/Project/nodegui/react-nodegui/extras/assets/nodegui_white.png"
);

const App = () => {
  return (
    <Window>
      <View>
        <Button
          text={"Hello"}
          icon={icon}
          iconSize={new QSize(200, 200)}
        />
      </View>
    </Window>
  );
};

from react-nodegui.

a7ul avatar a7ul commented on May 14, 2024

Could you try const newIcon = Icon.scaled(width, height); ? @talentlessguy

https://docs.nodegui.org/docs/api/QPixmap#pixmapscaledwidth-height-aspectratiomode

from react-nodegui.

talentlessguy avatar talentlessguy commented on May 14, 2024

@master-atul

const Icon = new QIcon(`${__dirname}/${icon}`)

Icon.scaled() // trying to call the method
Property 'scaled' does not exist on type 'QIcon'.

When I try to use QImage instead:

image

from react-nodegui.

a7ul avatar a7ul commented on May 14, 2024

Alright, seems like a missing functionality. Will add it in the next release. @talentlessguy

from react-nodegui.

talentlessguy avatar talentlessguy commented on May 14, 2024

Alright, seems like a missing functionality. Will add it in the next release. @talentlessguy

awesome! looking forward to this feature

from react-nodegui.

talentlessguy avatar talentlessguy commented on May 14, 2024

@master-atul

while this functionality is being implemented in react-nodegui, is it possible to achieve it with plain nodegui with combination of react-nodegui?

from react-nodegui.

talentlessguy avatar talentlessguy commented on May 14, 2024

iconSize prop is now available in 0.2.7 of react-nodegui for button, checkbox and radiobuttons

How can I use it? Please give an example

from react-nodegui.

ADARSHYODHA avatar ADARSHYODHA commented on May 14, 2024

Hello @a7ul
Can u tell me how can we make a messagebox or alertbox in react-nodegui

from react-nodegui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.